mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
Removed even more old code
This commit is contained in:
parent
9185244718
commit
5b11649c55
@ -175,7 +175,6 @@ import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
import com.cloud.storage.StorageLayer;
|
||||
import com.cloud.storage.StoragePoolVO;
|
||||
import com.cloud.storage.Volume;
|
||||
import com.cloud.storage.Volume.VolumeType;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
@ -1686,10 +1685,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
||||
|
||||
}
|
||||
|
||||
private StoragePool createNfsStoragePool(Connect conn, StoragePoolVO pool) {
|
||||
private StoragePool createNfsStoragePool(Connect conn, StorageFilerTO pool) {
|
||||
String targetPath = _mountPoint + File.separator + pool.getUuid();
|
||||
LibvirtStoragePoolDef spd = new LibvirtStoragePoolDef(poolType.NFS, pool.getUuid(), pool.getUuid(),
|
||||
pool.getHostAddress(), pool.getPath(), targetPath);
|
||||
pool.getHost(), pool.getPath(), targetPath);
|
||||
_storage.mkdir(targetPath);
|
||||
StoragePool sp = null;
|
||||
try {
|
||||
@ -1715,7 +1714,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
||||
}
|
||||
}
|
||||
|
||||
private StoragePool getStoragePool(Connect conn, StoragePoolVO pool) {
|
||||
private StoragePool getStoragePool(Connect conn, StorageFilerTO pool) {
|
||||
StoragePool sp = null;
|
||||
try {
|
||||
sp = conn.storagePoolLookupByUUIDString(pool.getUuid());
|
||||
@ -1724,7 +1723,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
||||
}
|
||||
|
||||
if (sp == null) {
|
||||
if (pool.getPoolType() == StoragePoolType.NetworkFilesystem) {
|
||||
if (pool.getType() == StoragePoolType.NetworkFilesystem) {
|
||||
sp = createNfsStoragePool(conn, pool);
|
||||
}
|
||||
if (sp == null) {
|
||||
@ -1764,7 +1763,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
||||
tInfo);
|
||||
|
||||
KVMHABase.NfsStoragePool pool = new KVMHABase.NfsStoragePool(cmd.getPool().getUuid(),
|
||||
cmd.getPool().getHostAddress(),
|
||||
cmd.getPool().getHost(),
|
||||
cmd.getPool().getPath(),
|
||||
_mountPoint + File.separator + cmd.getPool().getUuid(),
|
||||
PoolType.PrimaryStorage);
|
||||
@ -2020,25 +2019,26 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
||||
}
|
||||
|
||||
private synchronized Answer execute(PrepareForMigrationCommand cmd) {
|
||||
final String vmName = cmd.getVmName();
|
||||
String result = null;
|
||||
|
||||
if (cmd.getVnet() != null && !isDirectAttachedNetwork(cmd.getVnet())) {
|
||||
final String vnet = getVnetId(cmd.getVnet());
|
||||
if (vnet != null) {
|
||||
try {
|
||||
createVnet(vnet, _pifs.first()); /*TODO: Need to add public network for domR*/
|
||||
} catch (InternalErrorException e) {
|
||||
return new PrepareForMigrationAnswer(cmd, false, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
synchronized(_vms) {
|
||||
_vms.put(vmName, State.Migrating);
|
||||
}
|
||||
|
||||
return new PrepareForMigrationAnswer(cmd, result == null, result);
|
||||
// final String vmName = cmd.getVmName();
|
||||
// String result = null;
|
||||
//
|
||||
// if (cmd.getVnet() != null && !isDirectAttachedNetwork(cmd.getVnet())) {
|
||||
// final String vnet = getVnetId(cmd.getVnet());
|
||||
// if (vnet != null) {
|
||||
// try {
|
||||
// createVnet(vnet, _pifs.first()); /*TODO: Need to add public network for domR*/
|
||||
// } catch (InternalErrorException e) {
|
||||
// return new PrepareForMigrationAnswer(cmd, false, result);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// synchronized(_vms) {
|
||||
// _vms.put(vmName, State.Migrating);
|
||||
// }
|
||||
//
|
||||
// return new PrepareForMigrationAnswer(cmd, result == null, result);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void createVnet(String vnetId, String pif) throws InternalErrorException {
|
||||
|
||||
@ -35,9 +35,9 @@ public class ModifyStoragePoolAnswer extends Answer {
|
||||
public ModifyStoragePoolAnswer(ModifyStoragePoolCommand cmd, long capacityBytes, long availableBytes, Map<String, TemplateInfo> tInfo) {
|
||||
super(cmd);
|
||||
this.result = true;
|
||||
this.poolInfo = new StoragePoolInfo(null, cmd.getPool().getName(),
|
||||
cmd.getPool().getHostAddress(), cmd.getPool().getPath(), cmd.getLocalPath(),
|
||||
cmd.getPool().getPoolType(), capacityBytes, availableBytes );
|
||||
this.poolInfo = new StoragePoolInfo(null,
|
||||
cmd.getPool().getHost(), cmd.getPool().getPath(), cmd.getLocalPath(),
|
||||
cmd.getPool().getType(), capacityBytes, availableBytes );
|
||||
|
||||
this.templateInfo = tInfo;
|
||||
}
|
||||
@ -21,12 +21,13 @@ package com.cloud.agent.api;
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.cloud.storage.StoragePoolVO;
|
||||
import com.cloud.agent.api.to.StorageFilerTO;
|
||||
import com.cloud.storage.StoragePool;
|
||||
|
||||
public class ModifyStoragePoolCommand extends Command {
|
||||
|
||||
boolean add;
|
||||
StoragePoolVO pool;
|
||||
StorageFilerTO pool;
|
||||
String localPath;
|
||||
String [] options;
|
||||
public static final String LOCAL_PATH_PREFIX="/mnt/";
|
||||
@ -36,23 +37,23 @@ public class ModifyStoragePoolCommand extends Command {
|
||||
|
||||
}
|
||||
|
||||
public ModifyStoragePoolCommand(boolean add, StoragePoolVO pool, String localPath) {
|
||||
public ModifyStoragePoolCommand(boolean add, StoragePool pool, String localPath) {
|
||||
this.add = add;
|
||||
this.pool = new StoragePoolVO(pool);
|
||||
this.pool = new StorageFilerTO(pool);
|
||||
this.localPath = localPath;
|
||||
|
||||
}
|
||||
|
||||
public ModifyStoragePoolCommand(boolean add, StoragePoolVO pool) {
|
||||
public ModifyStoragePoolCommand(boolean add, StoragePool pool) {
|
||||
this(add, pool, LOCAL_PATH_PREFIX + File.separator + UUID.nameUUIDFromBytes((pool.getHostAddress() + pool.getPath()).getBytes()));
|
||||
}
|
||||
|
||||
public StoragePoolVO getPool() {
|
||||
public StorageFilerTO getPool() {
|
||||
return pool;
|
||||
}
|
||||
|
||||
public void setPool(StoragePoolVO pool) {
|
||||
this.pool = pool;
|
||||
public void setPool(StoragePool pool) {
|
||||
this.pool = new StorageFilerTO(pool);
|
||||
}
|
||||
|
||||
public boolean getAdd() {
|
||||
@ -22,7 +22,6 @@ import java.util.Map;
|
||||
import com.cloud.storage.Storage.StoragePoolType;
|
||||
|
||||
public class StoragePoolInfo {
|
||||
String name;
|
||||
String uuid;
|
||||
String host;
|
||||
String localPath;
|
||||
@ -36,11 +35,10 @@ public class StoragePoolInfo {
|
||||
super();
|
||||
}
|
||||
|
||||
public StoragePoolInfo(String name, String uuid, String host, String hostPath,
|
||||
public StoragePoolInfo(String uuid, String host, String hostPath,
|
||||
String localPath, StoragePoolType poolType, long capacityBytes,
|
||||
long availableBytes) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.uuid = uuid;
|
||||
this.host = host;
|
||||
this.localPath = localPath;
|
||||
@ -50,10 +48,10 @@ public class StoragePoolInfo {
|
||||
this.availableBytes = availableBytes;
|
||||
}
|
||||
|
||||
public StoragePoolInfo(String name, String uuid, String host, String hostPath,
|
||||
public StoragePoolInfo(String uuid, String host, String hostPath,
|
||||
String localPath, StoragePoolType poolType, long capacityBytes,
|
||||
long availableBytes, Map<String, String> details) {
|
||||
this(name, uuid, host, hostPath, localPath, poolType, capacityBytes, availableBytes);
|
||||
this(uuid, host, hostPath, localPath, poolType, capacityBytes, availableBytes);
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
@ -84,14 +82,6 @@ public class StoragePoolInfo {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Map<String, String> getDetails() {
|
||||
return details;
|
||||
}
|
||||
@ -1,82 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the GNU General Public License v3 or later.
|
||||
*
|
||||
* It is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.cloud.agent.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
|
||||
|
||||
public abstract class AbstractStartCommand extends Command {
|
||||
|
||||
protected String vmName;
|
||||
protected String storageHosts[] = new String[2];
|
||||
protected List<VolumeVO> volumes;
|
||||
protected boolean mirroredVols = false;
|
||||
protected BootloaderType bootloader = BootloaderType.PyGrub;
|
||||
|
||||
public AbstractStartCommand(String vmName, String storageHost, List<VolumeVO> vols) {
|
||||
this(vmName, new String[] {storageHost}, vols, false);
|
||||
}
|
||||
|
||||
public AbstractStartCommand(String vmName, String[] storageHosts, List<VolumeVO> volumes, boolean mirroredVols) {
|
||||
super();
|
||||
this.vmName = vmName;
|
||||
this.storageHosts = storageHosts;
|
||||
this.volumes = volumes;
|
||||
this.mirroredVols = mirroredVols;
|
||||
}
|
||||
|
||||
public BootloaderType getBootloader() {
|
||||
return bootloader;
|
||||
}
|
||||
|
||||
public void setBootloader(BootloaderType bootloader) {
|
||||
this.bootloader = bootloader;
|
||||
}
|
||||
|
||||
protected AbstractStartCommand() {
|
||||
super();
|
||||
}
|
||||
|
||||
public List<VolumeVO> getVolumes() {
|
||||
return volumes;
|
||||
}
|
||||
|
||||
public String getVmName() {
|
||||
return vmName;
|
||||
}
|
||||
|
||||
public String getStorageHost() {
|
||||
return storageHosts[0];
|
||||
}
|
||||
|
||||
public boolean isMirroredVols() {
|
||||
return mirroredVols;
|
||||
}
|
||||
|
||||
public void setMirroredVols(boolean mirroredVols) {
|
||||
this.mirroredVols = mirroredVols;
|
||||
}
|
||||
|
||||
public String [] getStorageHosts() {
|
||||
return storageHosts;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,33 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the GNU General Public License v3 or later.
|
||||
*
|
||||
* It is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.cloud.agent.api;
|
||||
|
||||
|
||||
public class CreateZoneVlanAnswer extends Answer{
|
||||
protected CreateZoneVlanAnswer() {
|
||||
}
|
||||
|
||||
public CreateZoneVlanAnswer(CreateZoneVlanCommand cmd) {
|
||||
super(cmd);
|
||||
}
|
||||
|
||||
public CreateZoneVlanAnswer(CreateZoneVlanCommand cmd, String details) {
|
||||
super(cmd, false, details);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,45 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||
*
|
||||
* This software is licensed under the GNU General Public License v3 or later.
|
||||
*
|
||||
* It is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.cloud.agent.api;
|
||||
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.vm.DomainRouterVO;
|
||||
|
||||
|
||||
public class CreateZoneVlanCommand extends Command {
|
||||
|
||||
DomainRouterVO router;
|
||||
|
||||
protected CreateZoneVlanCommand() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public CreateZoneVlanCommand(DomainRouterVO router) {
|
||||
this.router = router;
|
||||
}
|
||||
|
||||
public VirtualRouter getRouter() {
|
||||
return router;
|
||||
}
|
||||
|
||||
}
|
||||
@ -18,18 +18,17 @@
|
||||
package com.cloud.agent.api;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.storage.VolumeVO;
|
||||
|
||||
public class PrepareForMigrationCommand extends AbstractStartCommand {
|
||||
public class PrepareForMigrationCommand extends StartCommand {
|
||||
String vnet;
|
||||
|
||||
protected PrepareForMigrationCommand() {
|
||||
}
|
||||
|
||||
public PrepareForMigrationCommand(String vmName, String vnet, String[] storageHosts, List<VolumeVO> vols, boolean mirrored) {
|
||||
super(vmName, storageHosts, vols, mirrored);
|
||||
//super(vmName, storageHosts, vols, mirrored);
|
||||
this.vnet = vnet;
|
||||
}
|
||||
|
||||
|
||||
@ -1760,96 +1760,97 @@ public abstract class CitrixResourceBase implements ServerResource {
|
||||
* List<VolumeVO> vols = cmd.getVolumes(); result = mountwithoutvdi(vols, cmd.getMappings()); if (result !=
|
||||
* null) { return new PrepareForMigrationAnswer(cmd, false, result); }
|
||||
*/
|
||||
final String vmName = cmd.getVmName();
|
||||
try {
|
||||
Set<Host> hosts = Host.getAll(conn);
|
||||
// workaround before implementing xenserver pool
|
||||
// no migration
|
||||
if (hosts.size() <= 1) {
|
||||
return new PrepareForMigrationAnswer(cmd, false, "not in a same xenserver pool");
|
||||
}
|
||||
// if the vm have CD
|
||||
// 1. make iosSR shared
|
||||
// 2. create pbd in target xenserver
|
||||
SR sr = getISOSRbyVmName(conn, cmd.getVmName());
|
||||
if (sr != null) {
|
||||
Set<PBD> pbds = sr.getPBDs(conn);
|
||||
boolean found = false;
|
||||
for (PBD pbd : pbds) {
|
||||
if (Host.getByUuid(conn, _host.uuid).equals(pbd.getHost(conn))) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
sr.setShared(conn, true);
|
||||
PBD pbd = pbds.iterator().next();
|
||||
PBD.Record pbdr = new PBD.Record();
|
||||
pbdr.deviceConfig = pbd.getDeviceConfig(conn);
|
||||
pbdr.host = Host.getByUuid(conn, _host.uuid);
|
||||
pbdr.SR = sr;
|
||||
PBD newpbd = PBD.create(conn, pbdr);
|
||||
newpbd.plug(conn);
|
||||
}
|
||||
}
|
||||
Set<VM> vms = VM.getByNameLabel(conn, vmName);
|
||||
if (vms.size() != 1) {
|
||||
String msg = "There are " + vms.size() + " " + vmName;
|
||||
s_logger.warn(msg);
|
||||
return new PrepareForMigrationAnswer(cmd, false, msg);
|
||||
}
|
||||
|
||||
VM vm = vms.iterator().next();
|
||||
|
||||
// check network
|
||||
Set<VIF> vifs = vm.getVIFs(conn);
|
||||
for (VIF vif : vifs) {
|
||||
Network network = vif.getNetwork(conn);
|
||||
Set<PIF> pifs = network.getPIFs(conn);
|
||||
long vlan = -1;
|
||||
PIF npif = null;
|
||||
for (PIF pif : pifs) {
|
||||
try {
|
||||
vlan = pif.getVLAN(conn);
|
||||
if (vlan != -1 ) {
|
||||
VLAN vland = pif.getVLANMasterOf(conn);
|
||||
npif = vland.getTaggedPIF(conn);
|
||||
}
|
||||
break;
|
||||
}catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (npif == null) {
|
||||
continue;
|
||||
}
|
||||
network = npif.getNetwork(conn);
|
||||
String nwuuid = network.getUuid(conn);
|
||||
|
||||
String pifuuid = null;
|
||||
if(nwuuid.equalsIgnoreCase(_host.privateNetwork)) {
|
||||
pifuuid = _host.privatePif;
|
||||
} else if(nwuuid.equalsIgnoreCase(_host.publicNetwork)) {
|
||||
pifuuid = _host.publicPif;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
Network vlanNetwork = enableVlanNetwork(conn, vlan, pifuuid);
|
||||
|
||||
if (vlanNetwork == null) {
|
||||
throw new InternalErrorException("Failed to enable VLAN network with tag: " + vlan);
|
||||
}
|
||||
}
|
||||
|
||||
synchronized (_vms) {
|
||||
_vms.put(cmd.getVmName(), State.Migrating);
|
||||
}
|
||||
return new PrepareForMigrationAnswer(cmd, true, null);
|
||||
} catch (Exception e) {
|
||||
String msg = "catch exception " + e.getMessage();
|
||||
s_logger.warn(msg, e);
|
||||
return new PrepareForMigrationAnswer(cmd, false, msg);
|
||||
}
|
||||
// final String vmName = cmd.getVmName();
|
||||
// try {
|
||||
// Set<Host> hosts = Host.getAll(conn);
|
||||
// // workaround before implementing xenserver pool
|
||||
// // no migration
|
||||
// if (hosts.size() <= 1) {
|
||||
// return new PrepareForMigrationAnswer(cmd, false, "not in a same xenserver pool");
|
||||
// }
|
||||
// // if the vm have CD
|
||||
// // 1. make iosSR shared
|
||||
// // 2. create pbd in target xenserver
|
||||
// SR sr = getISOSRbyVmName(conn, cmd.getVmName());
|
||||
// if (sr != null) {
|
||||
// Set<PBD> pbds = sr.getPBDs(conn);
|
||||
// boolean found = false;
|
||||
// for (PBD pbd : pbds) {
|
||||
// if (Host.getByUuid(conn, _host.uuid).equals(pbd.getHost(conn))) {
|
||||
// found = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (!found) {
|
||||
// sr.setShared(conn, true);
|
||||
// PBD pbd = pbds.iterator().next();
|
||||
// PBD.Record pbdr = new PBD.Record();
|
||||
// pbdr.deviceConfig = pbd.getDeviceConfig(conn);
|
||||
// pbdr.host = Host.getByUuid(conn, _host.uuid);
|
||||
// pbdr.SR = sr;
|
||||
// PBD newpbd = PBD.create(conn, pbdr);
|
||||
// newpbd.plug(conn);
|
||||
// }
|
||||
// }
|
||||
// Set<VM> vms = VM.getByNameLabel(conn, vmName);
|
||||
// if (vms.size() != 1) {
|
||||
// String msg = "There are " + vms.size() + " " + vmName;
|
||||
// s_logger.warn(msg);
|
||||
// return new PrepareForMigrationAnswer(cmd, false, msg);
|
||||
// }
|
||||
//
|
||||
// VM vm = vms.iterator().next();
|
||||
//
|
||||
// // check network
|
||||
// Set<VIF> vifs = vm.getVIFs(conn);
|
||||
// for (VIF vif : vifs) {
|
||||
// Network network = vif.getNetwork(conn);
|
||||
// Set<PIF> pifs = network.getPIFs(conn);
|
||||
// long vlan = -1;
|
||||
// PIF npif = null;
|
||||
// for (PIF pif : pifs) {
|
||||
// try {
|
||||
// vlan = pif.getVLAN(conn);
|
||||
// if (vlan != -1 ) {
|
||||
// VLAN vland = pif.getVLANMasterOf(conn);
|
||||
// npif = vland.getTaggedPIF(conn);
|
||||
// }
|
||||
// break;
|
||||
// }catch (Exception e) {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// if (npif == null) {
|
||||
// continue;
|
||||
// }
|
||||
// network = npif.getNetwork(conn);
|
||||
// String nwuuid = network.getUuid(conn);
|
||||
//
|
||||
// String pifuuid = null;
|
||||
// if(nwuuid.equalsIgnoreCase(_host.privateNetwork)) {
|
||||
// pifuuid = _host.privatePif;
|
||||
// } else if(nwuuid.equalsIgnoreCase(_host.publicNetwork)) {
|
||||
// pifuuid = _host.publicPif;
|
||||
// } else {
|
||||
// continue;
|
||||
// }
|
||||
// Network vlanNetwork = enableVlanNetwork(conn, vlan, pifuuid);
|
||||
//
|
||||
// if (vlanNetwork == null) {
|
||||
// throw new InternalErrorException("Failed to enable VLAN network with tag: " + vlan);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// synchronized (_vms) {
|
||||
// _vms.put(cmd.getVmName(), State.Migrating);
|
||||
// }
|
||||
// return new PrepareForMigrationAnswer(cmd, true, null);
|
||||
// } catch (Exception e) {
|
||||
// String msg = "catch exception " + e.getMessage();
|
||||
// s_logger.warn(msg, e);
|
||||
// return new PrepareForMigrationAnswer(cmd, false, msg);
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
public PrimaryStorageDownloadAnswer execute(final PrimaryStorageDownloadCommand cmd) {
|
||||
@ -3210,7 +3211,7 @@ public abstract class CitrixResourceBase implements ServerResource {
|
||||
lvmsr.setNameDescription(conn, name);
|
||||
Host host = Host.getByUuid(conn, _host.uuid);
|
||||
String address = host.getAddress(conn);
|
||||
StoragePoolInfo pInfo = new StoragePoolInfo(name, lvmuuid, address, SRType.LVM.toString(), SRType.LVM.toString(), StoragePoolType.LVM, cap, avail);
|
||||
StoragePoolInfo pInfo = new StoragePoolInfo(name, address, SRType.LVM.toString(), SRType.LVM.toString(), StoragePoolType.LVM, cap, avail);
|
||||
StartupStorageCommand cmd = new StartupStorageCommand();
|
||||
cmd.setPoolInfo(pInfo);
|
||||
cmd.setGuid(_host.uuid);
|
||||
@ -3747,14 +3748,13 @@ public abstract class CitrixResourceBase implements ServerResource {
|
||||
|
||||
protected Answer execute(ModifyStoragePoolCommand cmd) {
|
||||
Connection conn = getConnection();
|
||||
StoragePoolVO pool = cmd.getPool();
|
||||
StorageFilerTO poolTO = new StorageFilerTO(pool);
|
||||
StorageFilerTO pool = cmd.getPool();
|
||||
try {
|
||||
SR sr = getStorageRepository(conn, poolTO);
|
||||
SR sr = getStorageRepository(conn, pool);
|
||||
long capacity = sr.getPhysicalSize(conn);
|
||||
long available = capacity - sr.getPhysicalUtilisation(conn);
|
||||
if (capacity == -1) {
|
||||
String msg = "Pool capacity is -1! pool: " + pool.getName() + pool.getHostAddress() + pool.getPath();
|
||||
String msg = "Pool capacity is -1! pool: " + pool.getHost() + pool.getPath();
|
||||
s_logger.warn(msg);
|
||||
return new Answer(cmd, false, msg);
|
||||
}
|
||||
@ -3762,11 +3762,11 @@ public abstract class CitrixResourceBase implements ServerResource {
|
||||
ModifyStoragePoolAnswer answer = new ModifyStoragePoolAnswer(cmd, capacity, available, tInfo);
|
||||
return answer;
|
||||
} catch (XenAPIException e) {
|
||||
String msg = "ModifyStoragePoolCommand XenAPIException:" + e.toString() + " host:" + _host.uuid + " pool: " + pool.getName() + pool.getHostAddress() + pool.getPath();
|
||||
String msg = "ModifyStoragePoolCommand XenAPIException:" + e.toString() + " host:" + _host.uuid + " pool: " + pool.getHost() + pool.getPath();
|
||||
s_logger.warn(msg, e);
|
||||
return new Answer(cmd, false, msg);
|
||||
} catch (Exception e) {
|
||||
String msg = "ModifyStoragePoolCommand XenAPIException:" + e.getMessage() + " host:" + _host.uuid + " pool: " + pool.getName() + pool.getHostAddress() + pool.getPath();
|
||||
String msg = "ModifyStoragePoolCommand XenAPIException:" + e.getMessage() + " host:" + _host.uuid + " pool: " + pool.getHost() + pool.getPath();
|
||||
s_logger.warn(msg, e);
|
||||
return new Answer(cmd, false, msg);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user