Package com.cloud.vm

Examples of com.cloud.vm.SecondaryStorageVmVO


                throw new CloudRuntimeException(errorString);
            }

            List<SecondaryStorageVmVO> ssVms = _secStorageVmDao.getSecStorageVmListInStates(SecondaryStorageVm.Role.templateProcessor, dataCenterId, State.Running);
          if (ssVms.size() > 0) {
                SecondaryStorageVmVO ssVm = ssVms.get(0);
                if (ssVm.getPublicIpAddress() == null) {
                    errorString = "A running secondary storage vm has a null public ip?";
                    s_logger.error(errorString);
                    throw new CloudRuntimeException(errorString);
                }
                //Construct actual URL locally now that the symlink exists at SSVM
                String extractURL = generateCopyUrl(ssVm.getPublicIpAddress(), uuid);
                UploadVO vo = _uploadDao.createForUpdate();
                vo.setLastUpdated(new Date());
                vo.setUploadUrl(extractURL);
                vo.setUploadState(Status.DOWNLOAD_URL_CREATED);
                _uploadDao.update(uploadId, vo);
View Full Code Here


        return _secStorageVmDao.findById(instanceId);
    }

    @ActionEvent(eventType = EventTypes.EVENT_SSVM_DESTROY, eventDescription = "destroying secondary storage Vm", async = true)
    public SecondaryStorageVmVO destroySecondaryStorageVm(long instanceId) {
        SecondaryStorageVmVO secStorageVm = _secStorageVmDao.findById(instanceId);
        if (_secStorageVmMgr.destroySecStorageVm(instanceId)) {
            return secStorageVm;
        }
        return null;
    }
View Full Code Here

  }
 
  private String generateCopyUrl(HostVO sourceServer, VMTemplateHostVO srcTmpltHost) {
    List<SecondaryStorageVmVO> ssVms = _secStorageVmDao.getSecStorageVmListInStates(SecondaryStorageVm.Role.templateProcessor, sourceServer.getDataCenterId(), State.Running);
    if (ssVms.size() > 0) {
      SecondaryStorageVmVO ssVm = ssVms.get(0);
      if (ssVm.getPublicIpAddress() == null) {
        s_logger.warn("A running secondary storage vm has a null public ip?");
        return null;
      }
      return generateCopyUrl(ssVm.getPublicIpAddress(), sourceServer.getParent(), srcTmpltHost.getInstallPath());
    }
   
    VMTemplateVO tmplt = _templateDao.findById(srcTmpltHost.getTemplateId());
    HypervisorType hyperType = tmplt.getHypervisorType();
    /*No secondary storage vm yet*/
 
View Full Code Here

        hostId = host.getId();
        hostAddress = host.getPrivateIpAddress();
        publicAddress = host.getPublicIpAddress();
        if (Host.Type.SecondaryStorageVM == host.getType()) {
            String vmName = host.getName();
            SecondaryStorageVmVO ssvm = vmDao.findByInstanceName(vmName);
            if (ssvm != null) {
                publicAddress = ssvm.getPublicIpAddress();
            }
        }
    }
View Full Code Here

                throw new CloudRuntimeException(errorString);
            }

            List<SecondaryStorageVmVO> ssVms = _secStorageVmDao.getSecStorageVmListInStates(SecondaryStorageVm.Role.templateProcessor, dataCenterId, State.Running);
            if (ssVms.size() > 0) {
                SecondaryStorageVmVO ssVm = ssVms.get(0);
                if (ssVm.getPublicIpAddress() == null) {
                    errorString = "A running secondary storage vm has a null public ip?";
                    s_logger.error(errorString);
                    throw new CloudRuntimeException(errorString);
                }
                //Construct actual URL locally now that the symlink exists at SSVM
                String extractURL = generateCopyUrl(ssVm.getPublicIpAddress(), uuid);
                UploadVO vo = _uploadDao.createForUpdate();
                vo.setLastUpdated(new Date());
                vo.setUploadUrl(extractURL);
                vo.setUploadState(Status.DOWNLOAD_URL_CREATED);
                _uploadDao.update(uploadId, vo);
View Full Code Here

                }

                // if the instance is of type secondary storage vm, call the
                // secondary storage vm manager
                if (vmInstance.getType().equals(VirtualMachine.Type.SecondaryStorageVm)) {
                    SecondaryStorageVmVO secStrgVm = _secStrgDao.findById(vmInstance.getId());
                    vmMgr.advanceStop(secStrgVm.getUuid(), false);
                    // update work status
                    work.setStoppedForMaintenance(true);
                    _storagePoolWorkDao.update(work.getId(), work);

                    if (restart) {
                        vmMgr.advanceStart(secStrgVm.getUuid(), null, null);
                        // update work status
                        work.setStartedAfterMaintenance(true);
                        _storagePoolWorkDao.update(work.getId(), work);
                    }
                }
View Full Code Here

                }

                // if the instance is of type ssvm, call the ssvm manager
                if (vmInstance.getType().equals(
                        VirtualMachine.Type.SecondaryStorageVm)) {
                    SecondaryStorageVmVO ssVm = _secStrgDao.findById(vmInstance
                            .getId());
                    vmMgr.advanceStart(ssVm.getUuid(), null, null);

                    // update work queue
                    work.setStartedAfterMaintenance(true);
                    _storagePoolWorkDao.update(work.getId(), work);
                }
View Full Code Here

    public void onSSVMAlert(Object sender, SecStorageVmAlertEventArgs args) {
      if(s_logger.isDebugEnabled())
        s_logger.debug("received secondary storage vm alert");
     
      DataCenterVO dc = _dcDao.findById(args.getZoneId());
       SecondaryStorageVmVO secStorageVm = args.getSecStorageVm();
      if(secStorageVm == null)
        secStorageVm = _ssvmDao.findById(args.getSecStorageVmId());
     
      switch(args.getType()) {
      case SecStorageVmAlertEventArgs.SSVM_CREATED :
          if(s_logger.isDebugEnabled())
            s_logger.debug("New secondary storage vm created, zone: " + dc.getName() + ", secStorageVm: " +
              secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " +
              secStorageVm.getPrivateIpAddress());
      break;
       
      case SecStorageVmAlertEventArgs.SSVM_UP :
          if(s_logger.isDebugEnabled())
            s_logger.debug("Secondary Storage Vm is up, zone: " + dc.getName() + ", secStorageVm: " +
              secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " +
              secStorageVm.getPrivateIpAddress());
       
      _alertMgr.sendAlert(
        AlertManager.ALERT_TYPE_SSVM,
        args.getZoneId(),
        secStorageVm.getPodIdToDeployIn(),
        "Secondary Storage Vm up in zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress()
           + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()),
         "Secondary Storage Vm up (zone " + dc.getName() + ")"  
      );
      break;
       
      case SecStorageVmAlertEventArgs.SSVM_DOWN :
          if(s_logger.isDebugEnabled())
            s_logger.debug("Secondary Storage Vm is down, zone: " + dc.getName() + ", secStorageVm: " +
              secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " +
              (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()));
       
      _alertMgr.sendAlert(
        AlertManager.ALERT_TYPE_SSVM,
        args.getZoneId(),
        secStorageVm.getPodIdToDeployIn(),
        "Secondary Storage Vm down in zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress()
           + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()),
         "Secondary Storage Vm down (zone " + dc.getName() + ")"  
      );
      break;
       
      case SecStorageVmAlertEventArgs.SSVM_REBOOTED :
          if(s_logger.isDebugEnabled())
            s_logger.debug("Secondary Storage Vm is rebooted, zone: " + dc.getName() + ", secStorageVm: " +
              secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " +
              (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()));
       
      _alertMgr.sendAlert(
        AlertManager.ALERT_TYPE_SSVM,
        args.getZoneId(),
        secStorageVm.getPodIdToDeployIn(),
        "Secondary Storage Vm rebooted in zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress()
           + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()),
         "Secondary Storage Vm rebooted (zone " + dc.getName() + ")"  
      );
      break;
     
      case SecStorageVmAlertEventArgs.SSVM_CREATE_FAILURE :
          if(s_logger.isDebugEnabled())
            s_logger.debug("Secondary Storage Vm creation failure, zone: " + dc.getName() + ", secStorageVm: " +
              secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " +
              (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()));
       
      _alertMgr.sendAlert(
        AlertManager.ALERT_TYPE_SSVM,
        args.getZoneId(),
        secStorageVm.getPodIdToDeployIn(),
        "Secondary Storage Vm creation failure. zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress()
           + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress())
           + ", error details: " + args.getMessage(),
         "Secondary Storage Vm creation failure (zone " + dc.getName() + ")"
      );
        break;
       
      case SecStorageVmAlertEventArgs.SSVM_START_FAILURE :
          if(s_logger.isDebugEnabled())
            s_logger.debug("Secondary Storage Vm startup failure, zone: " + dc.getName() + ", secStorageVm: " +
              secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " +
              (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()));
       
      _alertMgr.sendAlert(
        AlertManager.ALERT_TYPE_SSVM,
        args.getZoneId(),
        secStorageVm.getPodIdToDeployIn(),
        "Secondary Storage Vm startup failure. zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress()
           + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress())
           + ", error details: " + args.getMessage(),
         "Secondary Storage Vm startup failure (zone " + dc.getName() + ")"  
      );
        break;
     
      case SecStorageVmAlertEventArgs.SSVM_FIREWALL_ALERT :
          if(s_logger.isDebugEnabled())
            s_logger.debug("Secondary Storage Vm firewall alert, zone: " + dc.getName() + ", secStorageVm: " +
              secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " +
              (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()));
       
      _alertMgr.sendAlert(
        AlertManager.ALERT_TYPE_SSVM,
        args.getZoneId(),
        secStorageVm.getPodIdToDeployIn(),
        "Failed to open secondary storage vm firewall port. zone: " + dc.getName() + ", secStorageVm: " + secStorageVm.getHostName()
          + ", public IP: " + secStorageVm.getPublicIpAddress()
          + ", private IP: " + (secStorageVm.getPrivateIpAddress() == null ? "N/A" : secStorageVm.getPrivateIpAddress()),
        "Secondary Storage Vm alert (zone " + dc.getName() + ")" 
      );
        break;
     
      case SecStorageVmAlertEventArgs.SSVM_STORAGE_ALERT :
          if(s_logger.isDebugEnabled())
            s_logger.debug("Secondary Storage Vm storage alert, zone: " + dc.getName() + ", secStorageVm: " +
              secStorageVm.getHostName() + ", public IP: " + secStorageVm.getPublicIpAddress() + ", private IP: " +
              secStorageVm.getPrivateIpAddress() + ", message: " + args.getMessage());
       
      _alertMgr.sendAlert(
        AlertManager.ALERT_TYPE_STORAGE_MISC,
        args.getZoneId(),
        secStorageVm.getPodIdToDeployIn(),
        "Secondary Storage Vm storage issue. zone: " + dc.getName() + ", message: " + args.getMessage(),
        "Secondary Storage Vm alert (zone " + dc.getName() + ")"
      );
        break;
      }
View Full Code Here

  public Pair<HostVO, SecondaryStorageVmVO> assignSecStorageVm(long zoneId, Command cmd) {
   
    // TODO, need performance optimization
    List<Long> vms = _secStorageVmDao.listRunningSecStorageOrderByLoad(null, zoneId);
    for(Long vmId : vms) {
      SecondaryStorageVmVO secStorageVm = _secStorageVmDao.findById(vmId);
      HostVO host;
      host = _resourceMgr.findHostByName(secStorageVm.getHostName());
      if(host != null && host.getStatus() == Status.Up)
        return new Pair<HostVO, SecondaryStorageVmVO>(host, secStorageVm);
    }
   
    return null;
View Full Code Here

   
    @Override
    public boolean remove(Long id) {
        Transaction txn = Transaction.currentTxn();
        txn.start();
        SecondaryStorageVmVO proxy = createForUpdate();
        proxy.setPublicIpAddress(null);
        proxy.setPrivateIpAddress(null);
       
        UpdateBuilder ub = getUpdateBuilder(proxy);
        ub.set(proxy, "state", State.Destroyed);
        ub.set(proxy, "privateIpAddress", null);
        update(id, ub, proxy);
View Full Code Here

TOP

Related Classes of com.cloud.vm.SecondaryStorageVmVO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.