mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-16 10:32:34 +01:00
add start2command for secondarystorage vm
This commit is contained in:
parent
393666feea
commit
40481cfe6e
@ -26,6 +26,8 @@ import javax.persistence.PrimaryKeyJoinColumn;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
import com.cloud.vm.VirtualMachine.Type;
|
||||
|
||||
/**
|
||||
* SecondaryStorageVmVO domain object
|
||||
@ -86,7 +88,10 @@ public class SecondaryStorageVmVO extends VMInstanceVO implements SecondaryStora
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name="last_update", updatable=true, nullable=true)
|
||||
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(
|
||||
long id,
|
||||
|
||||
@ -249,7 +249,9 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
||||
@Override
|
||||
public SecondaryStorageVmVO startSecStorageVm(long secStorageVmId, long startEventId) {
|
||||
try {
|
||||
return start(secStorageVmId, startEventId);
|
||||
|
||||
return start2(secStorageVmId, startEventId);
|
||||
|
||||
} catch (StorageUnavailableException e) {
|
||||
s_logger.warn("Exception while trying to start secondary storage vm", e);
|
||||
return null;
|
||||
@ -259,6 +261,8 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
||||
} catch (ConcurrentOperationException e) {
|
||||
s_logger.warn("Exception while trying to start secondary storage vm", e);
|
||||
return null;
|
||||
} catch (ResourceUnavailableException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -668,7 +672,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
||||
if (s_logger.isDebugEnabled())
|
||||
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");
|
||||
if (secStorageVmId == 0) {
|
||||
@ -709,7 +713,6 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
||||
|
||||
long id = _secStorageVmDao.getNextInSequence(Long.class, "id");
|
||||
String name = VirtualMachineName.getSystemVmName(id, _instance, "s").intern();
|
||||
DataCenterVO dc = _dcDao.findById(dataCenterId);
|
||||
AccountVO systemAcct = _accountMgr.getSystemAccount();
|
||||
|
||||
DataCenterDeployment plan = new DataCenterDeployment(dataCenterId);
|
||||
@ -724,9 +727,10 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
||||
for (NetworkOfferingVO offering : offerings) {
|
||||
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 {
|
||||
proxy = _itMgr.allocate(proxy, _template, _serviceOffering, networks, plan, systemAcct);
|
||||
secStorageVm = _itMgr.allocate(secStorageVm, _template, _serviceOffering, networks, plan, systemAcct);
|
||||
} catch (InsufficientCapacityException e) {
|
||||
s_logger.warn("InsufficientCapacity", 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>();
|
||||
context.put("dc", dc);
|
||||
// context.put("publicIpAddress", publicIpAndVlan._ipAddr);
|
||||
HostPodVO pod = _podDao.findById(proxy.getPodId());
|
||||
context.put("pod", pod);
|
||||
context.put("proxyVmId", proxy.getId());
|
||||
|
||||
context.put("secStorageVmId", secStorageVm.getId());
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user