mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-17 11:04:00 +01:00
add start2command for secondarystorage vm
This commit is contained in:
parent
393666feea
commit
40481cfe6e
@ -27,6 +27,8 @@ import javax.persistence.Table;
|
|||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
import com.cloud.vm.VirtualMachine.Type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SecondaryStorageVmVO domain object
|
* SecondaryStorageVmVO domain object
|
||||||
*/
|
*/
|
||||||
@ -87,6 +89,9 @@ public class SecondaryStorageVmVO extends VMInstanceVO implements SecondaryStora
|
|||||||
@Column(name="last_update", updatable=true, nullable=true)
|
@Column(name="last_update", updatable=true, nullable=true)
|
||||||
private Date lastUpdateTime;
|
private Date lastUpdateTime;
|
||||||
|
|
||||||
|
public SecondaryStorageVmVO(long id, long serviceOfferingId, String name, long templateId, long guestOSId, long dataCenterId, long domainId, long accountId) {
|
||||||
|
super(id, serviceOfferingId, name, name, Type.SecondaryStorageVm, templateId, guestOSId, domainId, accountId, true);
|
||||||
|
}
|
||||||
|
|
||||||
public SecondaryStorageVmVO(
|
public SecondaryStorageVmVO(
|
||||||
long id,
|
long id,
|
||||||
|
|||||||
@ -249,7 +249,9 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||||||
@Override
|
@Override
|
||||||
public SecondaryStorageVmVO startSecStorageVm(long secStorageVmId, long startEventId) {
|
public SecondaryStorageVmVO startSecStorageVm(long secStorageVmId, long startEventId) {
|
||||||
try {
|
try {
|
||||||
return start(secStorageVmId, startEventId);
|
|
||||||
|
return start2(secStorageVmId, startEventId);
|
||||||
|
|
||||||
} catch (StorageUnavailableException e) {
|
} catch (StorageUnavailableException e) {
|
||||||
s_logger.warn("Exception while trying to start secondary storage vm", e);
|
s_logger.warn("Exception while trying to start secondary storage vm", e);
|
||||||
return null;
|
return null;
|
||||||
@ -259,6 +261,8 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||||||
} catch (ConcurrentOperationException e) {
|
} catch (ConcurrentOperationException e) {
|
||||||
s_logger.warn("Exception while trying to start secondary storage vm", e);
|
s_logger.warn("Exception while trying to start secondary storage vm", e);
|
||||||
return null;
|
return null;
|
||||||
|
} catch (ResourceUnavailableException e) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -668,7 +672,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||||||
if (s_logger.isDebugEnabled())
|
if (s_logger.isDebugEnabled())
|
||||||
s_logger.debug("Assign secondary storage vm from a newly started instance for request from data center : " + dataCenterId);
|
s_logger.debug("Assign secondary storage vm from a newly started instance for request from data center : " + dataCenterId);
|
||||||
|
|
||||||
Map<String, Object> context = createSecStorageVmInstance(dataCenterId);
|
Map<String, Object> context = createSecStorageVmInstance2(dataCenterId);
|
||||||
|
|
||||||
long secStorageVmId = (Long) context.get("secStorageVmId");
|
long secStorageVmId = (Long) context.get("secStorageVmId");
|
||||||
if (secStorageVmId == 0) {
|
if (secStorageVmId == 0) {
|
||||||
@ -709,7 +713,6 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||||||
|
|
||||||
long id = _secStorageVmDao.getNextInSequence(Long.class, "id");
|
long id = _secStorageVmDao.getNextInSequence(Long.class, "id");
|
||||||
String name = VirtualMachineName.getSystemVmName(id, _instance, "s").intern();
|
String name = VirtualMachineName.getSystemVmName(id, _instance, "s").intern();
|
||||||
DataCenterVO dc = _dcDao.findById(dataCenterId);
|
|
||||||
AccountVO systemAcct = _accountMgr.getSystemAccount();
|
AccountVO systemAcct = _accountMgr.getSystemAccount();
|
||||||
|
|
||||||
DataCenterDeployment plan = new DataCenterDeployment(dataCenterId);
|
DataCenterDeployment plan = new DataCenterDeployment(dataCenterId);
|
||||||
@ -724,9 +727,10 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||||||
for (NetworkOfferingVO offering : offerings) {
|
for (NetworkOfferingVO offering : offerings) {
|
||||||
networks.add(new Pair<NetworkConfigurationVO, NicProfile>(_networkMgr.setupNetworkConfiguration(systemAcct, offering, plan).get(0), null));
|
networks.add(new Pair<NetworkConfigurationVO, NicProfile>(_networkMgr.setupNetworkConfiguration(systemAcct, offering, plan).get(0), null));
|
||||||
}
|
}
|
||||||
SecondaryStorageVmVO proxy = new SecondaryStorageVmVO(id, _serviceOffering.getId(), name, _template.getId(), _template.getGuestOSId(), dataCenterId, systemAcct.getDomainId(), systemAcct.getId(), 0);
|
SecondaryStorageVmVO secStorageVm = new SecondaryStorageVmVO(id, _serviceOffering.getId(), name, _template.getId(),
|
||||||
|
_template.getGuestOSId(), dataCenterId, systemAcct.getDomainId(), systemAcct.getId());
|
||||||
try {
|
try {
|
||||||
proxy = _itMgr.allocate(proxy, _template, _serviceOffering, networks, plan, systemAcct);
|
secStorageVm = _itMgr.allocate(secStorageVm, _template, _serviceOffering, networks, plan, systemAcct);
|
||||||
} catch (InsufficientCapacityException e) {
|
} catch (InsufficientCapacityException e) {
|
||||||
s_logger.warn("InsufficientCapacity", e);
|
s_logger.warn("InsufficientCapacity", e);
|
||||||
throw new CloudRuntimeException("Insufficient capacity exception", e);
|
throw new CloudRuntimeException("Insufficient capacity exception", e);
|
||||||
@ -736,12 +740,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> context = new HashMap<String, Object>();
|
Map<String, Object> context = new HashMap<String, Object>();
|
||||||
context.put("dc", dc);
|
context.put("secStorageVmId", secStorageVm.getId());
|
||||||
// context.put("publicIpAddress", publicIpAndVlan._ipAddr);
|
|
||||||
HostPodVO pod = _podDao.findById(proxy.getPodId());
|
|
||||||
context.put("pod", pod);
|
|
||||||
context.put("proxyVmId", proxy.getId());
|
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user