Search in sources :

Example 31 with NfsTO

use of com.cloud.agent.api.to.NfsTO in project cloudstack by apache.

the class XenServerStorageProcessor method copyVolumeFromImageCacheToPrimary.

@Override
public Answer copyVolumeFromImageCacheToPrimary(final CopyCommand cmd) {
    final Connection conn = hypervisorResource.getConnection();
    final DataTO srcData = cmd.getSrcTO();
    final DataTO destData = cmd.getDestTO();
    final int wait = cmd.getWait();
    final VolumeObjectTO srcVolume = (VolumeObjectTO) srcData;
    final VolumeObjectTO destVolume = (VolumeObjectTO) destData;
    final DataStoreTO srcStore = srcVolume.getDataStore();
    if (srcStore instanceof NfsTO) {
        final NfsTO nfsStore = (NfsTO) srcStore;
        try {
            final PrimaryDataStoreTO destStore = (PrimaryDataStoreTO) destVolume.getDataStore();
            final SR primaryStoragePool = hypervisorResource.getStorageRepository(conn, CitrixHelper.getSRNameLabel(destStore.getUuid(), destStore.getPoolType(), destStore.getPath()));
            final String srUuid = primaryStoragePool.getUuid(conn);
            final URI uri = new URI(nfsStore.getUrl());
            final String volumePath = uri.getHost() + ":" + uri.getPath() + nfsStore.getPathSeparator() + srcVolume.getPath();
            final String uuid = copy_vhd_from_secondarystorage(conn, volumePath, srUuid, wait);
            final VolumeObjectTO newVol = new VolumeObjectTO();
            newVol.setPath(uuid);
            newVol.setSize(srcVolume.getSize());
            return new CopyCmdAnswer(newVol);
        } catch (final Exception e) {
            final String msg = "Catch Exception " + e.getClass().getName() + " due to " + e.toString();
            s_logger.warn(msg, e);
            return new CopyCmdAnswer(e.toString());
        }
    }
    s_logger.debug("unsupported protocol");
    return new CopyCmdAnswer("unsupported protocol");
}
Also used : PrimaryDataStoreTO(org.apache.cloudstack.storage.to.PrimaryDataStoreTO) DataStoreTO(com.cloud.agent.api.to.DataStoreTO) DataTO(com.cloud.agent.api.to.DataTO) PrimaryDataStoreTO(org.apache.cloudstack.storage.to.PrimaryDataStoreTO) Connection(com.xensource.xenapi.Connection) VolumeObjectTO(org.apache.cloudstack.storage.to.VolumeObjectTO) NfsTO(com.cloud.agent.api.to.NfsTO) URI(java.net.URI) CopyCmdAnswer(org.apache.cloudstack.storage.command.CopyCmdAnswer) XenAPIException(com.xensource.xenapi.Types.XenAPIException) InternalErrorException(com.cloud.exception.InternalErrorException) XmlRpcException(org.apache.xmlrpc.XmlRpcException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) SR(com.xensource.xenapi.SR)

Example 32 with NfsTO

use of com.cloud.agent.api.to.NfsTO in project cloudstack by apache.

the class XenServerStorageProcessor method copyVolumeFromPrimaryToSecondary.

@Override
public Answer copyVolumeFromPrimaryToSecondary(final CopyCommand cmd) {
    final Connection conn = hypervisorResource.getConnection();
    final VolumeObjectTO srcVolume = (VolumeObjectTO) cmd.getSrcTO();
    final VolumeObjectTO destVolume = (VolumeObjectTO) cmd.getDestTO();
    final int wait = cmd.getWait();
    final DataStoreTO destStore = destVolume.getDataStore();
    if (destStore instanceof NfsTO) {
        SR secondaryStorage = null;
        try {
            final NfsTO nfsStore = (NfsTO) destStore;
            final URI uri = new URI(nfsStore.getUrl());
            final String nfsVersion = nfsStore.getNfsVersion();
            // Create the volume folder
            if (!hypervisorResource.createSecondaryStorageFolder(conn, uri.getHost() + ":" + uri.getPath(), destVolume.getPath(), nfsVersion)) {
                throw new InternalErrorException("Failed to create the volume folder.");
            }
            // Create a SR for the volume UUID folder
            secondaryStorage = hypervisorResource.createNfsSRbyURI(conn, new URI(nfsStore.getUrl() + nfsStore.getPathSeparator() + destVolume.getPath()), false);
            // Look up the volume on the source primary storage pool
            final VDI srcVdi = getVDIbyUuid(conn, srcVolume.getPath());
            // Copy the volume to secondary storage
            final VDI destVdi = hypervisorResource.cloudVDIcopy(conn, srcVdi, secondaryStorage, wait);
            final String destVolumeUUID = destVdi.getUuid(conn);
            final VolumeObjectTO newVol = new VolumeObjectTO();
            newVol.setPath(destVolume.getPath() + nfsStore.getPathSeparator() + destVolumeUUID + ".vhd");
            newVol.setSize(srcVolume.getSize());
            return new CopyCmdAnswer(newVol);
        } catch (final Exception e) {
            s_logger.debug("Failed to copy volume to secondary: " + e.toString());
            return new CopyCmdAnswer("Failed to copy volume to secondary: " + e.toString());
        } finally {
            hypervisorResource.removeSR(conn, secondaryStorage);
        }
    }
    return new CopyCmdAnswer("unsupported protocol");
}
Also used : PrimaryDataStoreTO(org.apache.cloudstack.storage.to.PrimaryDataStoreTO) DataStoreTO(com.cloud.agent.api.to.DataStoreTO) Connection(com.xensource.xenapi.Connection) VolumeObjectTO(org.apache.cloudstack.storage.to.VolumeObjectTO) VDI(com.xensource.xenapi.VDI) InternalErrorException(com.cloud.exception.InternalErrorException) NfsTO(com.cloud.agent.api.to.NfsTO) URI(java.net.URI) CopyCmdAnswer(org.apache.cloudstack.storage.command.CopyCmdAnswer) XenAPIException(com.xensource.xenapi.Types.XenAPIException) InternalErrorException(com.cloud.exception.InternalErrorException) XmlRpcException(org.apache.xmlrpc.XmlRpcException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) SR(com.xensource.xenapi.SR)

Example 33 with NfsTO

use of com.cloud.agent.api.to.NfsTO in project cloudstack by apache.

the class XenServerStorageProcessor method dettachIso.

@Override
public Answer dettachIso(final DettachCommand cmd) {
    final DiskTO disk = cmd.getDisk();
    final DataTO data = disk.getData();
    final DataStoreTO store = data.getDataStore();
    String isoURL = null;
    if (store == null) {
        final TemplateObjectTO iso = (TemplateObjectTO) disk.getData();
        isoURL = iso.getName();
    } else {
        if (!(store instanceof NfsTO)) {
            s_logger.debug("Can't detach a iso which is not created on nfs: ");
            return new AttachAnswer("Can't detach a iso which is not created on nfs: ");
        }
        final NfsTO nfsStore = (NfsTO) store;
        isoURL = nfsStore.getUrl() + nfsStore.getPathSeparator() + data.getPath();
    }
    try {
        final Connection conn = hypervisorResource.getConnection();
        // Find the VM
        final VM vm = hypervisorResource.getVM(conn, cmd.getVmName());
        final String vmUUID = vm.getUuid(conn);
        // Find the ISO VDI
        final VDI isoVDI = hypervisorResource.getIsoVDIByURL(conn, cmd.getVmName(), isoURL);
        final SR sr = isoVDI.getSR(conn);
        // Look up all VBDs for this VDI
        final Set<VBD> vbds = isoVDI.getVBDs(conn);
        // the ISO from it
        for (final VBD vbd : vbds) {
            final VM vbdVM = vbd.getVM(conn);
            final String vbdVmUUID = vbdVM.getUuid(conn);
            if (vbdVmUUID.equals(vmUUID)) {
                // If an ISO is already inserted, eject it
                if (!vbd.getEmpty(conn)) {
                    vbd.eject(conn);
                }
                break;
            }
        }
        if (!XenServerUtilitiesHelper.isXenServerToolsSR(sr.getNameLabel(conn))) {
            hypervisorResource.removeSR(conn, sr);
        }
        return new DettachAnswer(disk);
    } catch (final XenAPIException e) {
        final String msg = "Failed to detach volume" + " for uuid: " + data.getPath() + "  due to " + e.toString();
        s_logger.warn(msg, e);
        return new DettachAnswer(msg);
    } catch (final Exception e) {
        final String msg = "Failed to detach volume" + " for uuid: " + data.getPath() + "  due to " + e.getMessage();
        s_logger.warn(msg, e);
        return new DettachAnswer(msg);
    }
}
Also used : PrimaryDataStoreTO(org.apache.cloudstack.storage.to.PrimaryDataStoreTO) DataStoreTO(com.cloud.agent.api.to.DataStoreTO) DettachAnswer(org.apache.cloudstack.storage.command.DettachAnswer) Connection(com.xensource.xenapi.Connection) XenAPIException(com.xensource.xenapi.Types.XenAPIException) NfsTO(com.cloud.agent.api.to.NfsTO) XenAPIException(com.xensource.xenapi.Types.XenAPIException) InternalErrorException(com.cloud.exception.InternalErrorException) XmlRpcException(org.apache.xmlrpc.XmlRpcException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) DataTO(com.cloud.agent.api.to.DataTO) VM(com.xensource.xenapi.VM) VBD(com.xensource.xenapi.VBD) VDI(com.xensource.xenapi.VDI) TemplateObjectTO(org.apache.cloudstack.storage.to.TemplateObjectTO) DiskTO(com.cloud.agent.api.to.DiskTO) AttachAnswer(org.apache.cloudstack.storage.command.AttachAnswer) SR(com.xensource.xenapi.SR)

Example 34 with NfsTO

use of com.cloud.agent.api.to.NfsTO in project cloudstack by apache.

the class XenServerGuru method getCommandHostDelegation.

@Override
public Pair<Boolean, Long> getCommandHostDelegation(long hostId, Command cmd) {
    if (cmd instanceof StorageSubSystemCommand) {
        StorageSubSystemCommand c = (StorageSubSystemCommand) cmd;
        c.setExecuteInSequence(true);
    }
    boolean isCopyCommand = cmd instanceof CopyCommand;
    Pair<Boolean, Long> defaultHostToExecuteCommands = super.getCommandHostDelegation(hostId, cmd);
    if (!isCopyCommand) {
        logger.debug("We are returning the default host to execute commands because the command is not of Copy type.");
        return defaultHostToExecuteCommands;
    }
    CopyCommand copyCommand = (CopyCommand) cmd;
    DataTO srcData = copyCommand.getSrcTO();
    DataTO destData = copyCommand.getDestTO();
    boolean isSourceDataHypervisorXenServer = srcData.getHypervisorType() == HypervisorType.XenServer;
    if (!isSourceDataHypervisorXenServer) {
        logger.debug("We are returning the default host to execute commands because the target hypervisor of the source data is not XenServer.");
        return defaultHostToExecuteCommands;
    }
    DataStoreTO srcStore = srcData.getDataStore();
    DataStoreTO destStore = destData.getDataStore();
    boolean isSourceAndDestinationNfsObjects = srcStore instanceof NfsTO && destStore instanceof NfsTO;
    if (!isSourceAndDestinationNfsObjects) {
        logger.debug("We are returning the default host to execute commands because the source and destination objects are not NFS type.");
        return defaultHostToExecuteCommands;
    }
    boolean isSourceObjectSnapshotTypeAndDestinationObjectTemplateType = srcData.getObjectType() == DataObjectType.SNAPSHOT && destData.getObjectType() == DataObjectType.TEMPLATE;
    if (!isSourceObjectSnapshotTypeAndDestinationObjectTemplateType) {
        logger.debug("We are returning the default host to execute commands because the source and destination objects are not snapshot and template respectively.");
        return defaultHostToExecuteCommands;
    }
    HostVO defaultHostToExecuteCommand = hostDao.findById(hostId);
    HostVO hostCandidateToExecutedCommand = hostDao.findHostInZoneToExecuteCommand(defaultHostToExecuteCommand.getDataCenterId(), srcData.getHypervisorType());
    hostDao.loadDetails(hostCandidateToExecutedCommand);
    String hypervisorVersion = hostCandidateToExecutedCommand.getHypervisorVersion();
    if (StringUtils.isBlank(hypervisorVersion)) {
        logger.debug("We are returning the default host to execute commands because the hypervisor version is blank.");
        return defaultHostToExecuteCommands;
    }
    boolean isXenServer610 = StringUtils.equals(hypervisorVersion, "6.1.0");
    if (isXenServer610) {
        logger.debug("We are returning the default host to execute commands because the hypervisor version is 6.1.0.");
        return defaultHostToExecuteCommands;
    }
    String snapshotHotFixVersion = hostCandidateToExecutedCommand.getDetail(XenserverConfigs.XS620HotFix);
    boolean isXenServer620 = StringUtils.equals(hypervisorVersion, "6.2.0");
    if (isXenServer620 && !StringUtils.equalsIgnoreCase(XenserverConfigs.XSHotFix62ESP1004, snapshotHotFixVersion)) {
        logger.debug(String.format("We are returning the default host to execute commands because the hypervisor version is not 6.2.0 with hotfix ESP1004 [hypervisorVersion=%s, hotfixVersion=%s]", hypervisorVersion, snapshotHotFixVersion));
        return defaultHostToExecuteCommands;
    }
    logger.debug(String.format("We are changing the hostId to executed command from %d to %d.", hostId, hostCandidateToExecutedCommand.getId()));
    return new Pair<Boolean, Long>(Boolean.TRUE, new Long(hostCandidateToExecutedCommand.getId()));
}
Also used : DataStoreTO(com.cloud.agent.api.to.DataStoreTO) StorageSubSystemCommand(org.apache.cloudstack.storage.command.StorageSubSystemCommand) DataTO(com.cloud.agent.api.to.DataTO) CopyCommand(org.apache.cloudstack.storage.command.CopyCommand) NfsTO(com.cloud.agent.api.to.NfsTO) HostVO(com.cloud.host.HostVO) Pair(com.cloud.utils.Pair)

Example 35 with NfsTO

use of com.cloud.agent.api.to.NfsTO in project cloudstack by apache.

the class LibvirtComputingResource method createVbd.

public void createVbd(final Connect conn, final VirtualMachineTO vmSpec, final String vmName, final LibvirtVMDef vm) throws InternalErrorException, LibvirtException, URISyntaxException {
    final Map<String, String> details = vmSpec.getDetails();
    final List<DiskTO> disks = Arrays.asList(vmSpec.getDisks());
    boolean isSecureBoot = false;
    boolean isWindowsTemplate = false;
    Collections.sort(disks, new Comparator<DiskTO>() {

        @Override
        public int compare(final DiskTO arg0, final DiskTO arg1) {
            return arg0.getDiskSeq() > arg1.getDiskSeq() ? 1 : -1;
        }
    });
    boolean isUefiEnabled = MapUtils.isNotEmpty(details) && details.containsKey(GuestDef.BootType.UEFI.toString());
    if (isUefiEnabled) {
        isSecureBoot = isSecureMode(details.get(GuestDef.BootType.UEFI.toString()));
    }
    if (vmSpec.getOs().toLowerCase().contains("window")) {
        isWindowsTemplate = true;
    }
    for (final DiskTO volume : disks) {
        KVMPhysicalDisk physicalDisk = null;
        KVMStoragePool pool = null;
        final DataTO data = volume.getData();
        if (volume.getType() == Volume.Type.ISO && data.getPath() != null) {
            DataStoreTO dataStore = data.getDataStore();
            String dataStoreUrl = null;
            if (data.getPath().startsWith(ConfigDrive.CONFIGDRIVEDIR) && vmSpec.isConfigDriveOnHostCache() && data instanceof TemplateObjectTO) {
                String configDrivePath = getConfigPath() + "/" + data.getPath();
                physicalDisk = new KVMPhysicalDisk(configDrivePath, ((TemplateObjectTO) data).getUuid(), null);
                physicalDisk.setFormat(PhysicalDiskFormat.FILE);
            } else if (dataStore instanceof NfsTO) {
                NfsTO nfsStore = (NfsTO) data.getDataStore();
                dataStoreUrl = nfsStore.getUrl();
                physicalDisk = getPhysicalDiskFromNfsStore(dataStoreUrl, data);
            } else if (dataStore instanceof PrimaryDataStoreTO) {
                // In order to support directly downloaded ISOs
                PrimaryDataStoreTO primaryDataStoreTO = (PrimaryDataStoreTO) dataStore;
                if (primaryDataStoreTO.getPoolType().equals(StoragePoolType.NetworkFilesystem)) {
                    String psHost = primaryDataStoreTO.getHost();
                    String psPath = primaryDataStoreTO.getPath();
                    dataStoreUrl = "nfs://" + psHost + File.separator + psPath;
                    physicalDisk = getPhysicalDiskFromNfsStore(dataStoreUrl, data);
                } else if (primaryDataStoreTO.getPoolType().equals(StoragePoolType.SharedMountPoint) || primaryDataStoreTO.getPoolType().equals(StoragePoolType.Filesystem)) {
                    physicalDisk = getPhysicalDiskPrimaryStore(primaryDataStoreTO, data);
                }
            }
        } else if (volume.getType() != Volume.Type.ISO) {
            final PrimaryDataStoreTO store = (PrimaryDataStoreTO) data.getDataStore();
            physicalDisk = _storagePoolMgr.getPhysicalDisk(store.getPoolType(), store.getUuid(), data.getPath());
            pool = physicalDisk.getPool();
        }
        String volPath = null;
        if (physicalDisk != null) {
            volPath = physicalDisk.getPath();
        }
        if (volume.getType() != Volume.Type.ISO && physicalDisk != null && physicalDisk.getFormat() == PhysicalDiskFormat.QCOW2 && (pool.getType() == StoragePoolType.NetworkFilesystem || pool.getType() == StoragePoolType.SharedMountPoint || pool.getType() == StoragePoolType.Filesystem || pool.getType() == StoragePoolType.Gluster)) {
            setBackingFileFormat(physicalDisk.getPath());
        }
        // check for disk activity, if detected we should exit because vm is running elsewhere
        if (_diskActivityCheckEnabled && physicalDisk != null && physicalDisk.getFormat() == PhysicalDiskFormat.QCOW2) {
            s_logger.debug("Checking physical disk file at path " + volPath + " for disk activity to ensure vm is not running elsewhere");
            try {
                HypervisorUtils.checkVolumeFileForActivity(volPath, _diskActivityCheckTimeoutSeconds, _diskActivityInactiveThresholdMilliseconds, _diskActivityCheckFileSizeMin);
            } catch (final IOException ex) {
                throw new CloudRuntimeException("Unable to check physical disk file for activity", ex);
            }
            s_logger.debug("Disk activity check cleared");
        }
        // if params contains a rootDiskController key, use its value (this is what other HVs are doing)
        DiskDef.DiskBus diskBusType = getDiskModelFromVMDetail(vmSpec);
        if (diskBusType == null) {
            diskBusType = getGuestDiskModel(vmSpec.getPlatformEmulator(), isUefiEnabled);
        }
        DiskDef.DiskBus diskBusTypeData = getDataDiskModelFromVMDetail(vmSpec);
        if (diskBusTypeData == null) {
            diskBusTypeData = (diskBusType == DiskDef.DiskBus.SCSI) ? diskBusType : DiskDef.DiskBus.VIRTIO;
        }
        final DiskDef disk = new DiskDef();
        int devId = volume.getDiskSeq().intValue();
        if (volume.getType() == Volume.Type.ISO) {
            disk.defISODisk(volPath, devId, isUefiEnabled);
            if (_guestCpuArch != null && _guestCpuArch.equals("aarch64")) {
                disk.setBusType(DiskDef.DiskBus.SCSI);
            }
        } else {
            if (diskBusType == DiskDef.DiskBus.SCSI) {
                disk.setQemuDriver(true);
                disk.setDiscard(DiscardType.UNMAP);
            }
            setDiskIoDriver(disk);
            if (pool.getType() == StoragePoolType.RBD) {
                /*
                            For RBD pools we use the secret mechanism in libvirt.
                            We store the secret under the UUID of the pool, that's why
                            we pass the pool's UUID as the authSecret
                     */
                disk.defNetworkBasedDisk(physicalDisk.getPath().replace("rbd:", ""), pool.getSourceHost(), pool.getSourcePort(), pool.getAuthUserName(), pool.getUuid(), devId, diskBusType, DiskProtocol.RBD, DiskDef.DiskFmtType.RAW);
            } else if (pool.getType() == StoragePoolType.PowerFlex) {
                disk.defBlockBasedDisk(physicalDisk.getPath(), devId, diskBusTypeData);
            } else if (pool.getType() == StoragePoolType.Gluster) {
                final String mountpoint = pool.getLocalPath();
                final String path = physicalDisk.getPath();
                final String glusterVolume = pool.getSourceDir().replace("/", "");
                disk.defNetworkBasedDisk(glusterVolume + path.replace(mountpoint, ""), pool.getSourceHost(), pool.getSourcePort(), null, null, devId, diskBusType, DiskProtocol.GLUSTER, DiskDef.DiskFmtType.QCOW2);
            } else if (pool.getType() == StoragePoolType.CLVM || physicalDisk.getFormat() == PhysicalDiskFormat.RAW) {
                if (volume.getType() == Volume.Type.DATADISK && !(isWindowsTemplate && isUefiEnabled)) {
                    disk.defBlockBasedDisk(physicalDisk.getPath(), devId, diskBusTypeData);
                } else {
                    disk.defBlockBasedDisk(physicalDisk.getPath(), devId, diskBusType);
                }
            } else {
                if (volume.getType() == Volume.Type.DATADISK && !(isWindowsTemplate && isUefiEnabled)) {
                    disk.defFileBasedDisk(physicalDisk.getPath(), devId, diskBusTypeData, DiskDef.DiskFmtType.QCOW2);
                } else {
                    if (isSecureBoot) {
                        disk.defFileBasedDisk(physicalDisk.getPath(), devId, DiskDef.DiskFmtType.QCOW2, isWindowsTemplate);
                    } else {
                        disk.defFileBasedDisk(physicalDisk.getPath(), devId, diskBusType, DiskDef.DiskFmtType.QCOW2);
                    }
                }
            }
        }
        if (data instanceof VolumeObjectTO) {
            final VolumeObjectTO volumeObjectTO = (VolumeObjectTO) data;
            disk.setSerial(diskUuidToSerial(volumeObjectTO.getUuid()));
            setBurstProperties(volumeObjectTO, disk);
            if (volumeObjectTO.getCacheMode() != null) {
                disk.setCacheMode(DiskDef.DiskCacheMode.valueOf(volumeObjectTO.getCacheMode().toString().toUpperCase()));
            }
        }
        if (vm.getDevices() == null) {
            s_logger.error("There is no devices for" + vm);
            throw new RuntimeException("There is no devices for" + vm);
        }
        vm.getDevices().addDevice(disk);
    }
    if (vmSpec.getType() != VirtualMachine.Type.User) {
        if (_sysvmISOPath != null) {
            final DiskDef iso = new DiskDef();
            iso.defISODisk(_sysvmISOPath);
            if (_guestCpuArch != null && _guestCpuArch.equals("aarch64")) {
                iso.setBusType(DiskDef.DiskBus.SCSI);
            }
            vm.getDevices().addDevice(iso);
        }
    }
    // For LXC, find and add the root filesystem, rbd data disks
    if (HypervisorType.LXC.toString().toLowerCase().equals(vm.getHvsType())) {
        for (final DiskTO volume : disks) {
            final DataTO data = volume.getData();
            final PrimaryDataStoreTO store = (PrimaryDataStoreTO) data.getDataStore();
            if (volume.getType() == Volume.Type.ROOT) {
                final KVMPhysicalDisk physicalDisk = _storagePoolMgr.getPhysicalDisk(store.getPoolType(), store.getUuid(), data.getPath());
                final FilesystemDef rootFs = new FilesystemDef(physicalDisk.getPath(), "/");
                vm.getDevices().addDevice(rootFs);
            } else if (volume.getType() == Volume.Type.DATADISK) {
                final KVMPhysicalDisk physicalDisk = _storagePoolMgr.getPhysicalDisk(store.getPoolType(), store.getUuid(), data.getPath());
                final KVMStoragePool pool = physicalDisk.getPool();
                if (StoragePoolType.RBD.equals(pool.getType())) {
                    final int devId = volume.getDiskSeq().intValue();
                    final String device = mapRbdDevice(physicalDisk);
                    if (device != null) {
                        s_logger.debug("RBD device on host is: " + device);
                        final DiskDef diskdef = new DiskDef();
                        diskdef.defBlockBasedDisk(device, devId, DiskDef.DiskBus.VIRTIO);
                        diskdef.setQemuDriver(false);
                        vm.getDevices().addDevice(diskdef);
                    } else {
                        throw new InternalErrorException("Error while mapping RBD device on host");
                    }
                }
            }
        }
    }
}
Also used : PrimaryDataStoreTO(org.apache.cloudstack.storage.to.PrimaryDataStoreTO) DataStoreTO(com.cloud.agent.api.to.DataStoreTO) KVMPhysicalDisk(com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk) FilesystemDef(com.cloud.hypervisor.kvm.resource.LibvirtVMDef.FilesystemDef) IOException(java.io.IOException) InternalErrorException(com.cloud.exception.InternalErrorException) NfsTO(com.cloud.agent.api.to.NfsTO) DiskDef(com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef) DataTO(com.cloud.agent.api.to.DataTO) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) KVMStoragePool(com.cloud.hypervisor.kvm.storage.KVMStoragePool) PrimaryDataStoreTO(org.apache.cloudstack.storage.to.PrimaryDataStoreTO) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) VolumeObjectTO(org.apache.cloudstack.storage.to.VolumeObjectTO) TemplateObjectTO(org.apache.cloudstack.storage.to.TemplateObjectTO) DiskTO(com.cloud.agent.api.to.DiskTO)

Aggregations

NfsTO (com.cloud.agent.api.to.NfsTO)142 DataStoreTO (com.cloud.agent.api.to.DataStoreTO)110 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)79 DataTO (com.cloud.agent.api.to.DataTO)71 InternalErrorException (com.cloud.exception.InternalErrorException)58 CopyCmdAnswer (org.apache.cloudstack.storage.command.CopyCmdAnswer)52 PrimaryDataStoreTO (org.apache.cloudstack.storage.to.PrimaryDataStoreTO)39 TemplateObjectTO (org.apache.cloudstack.storage.to.TemplateObjectTO)38 XmlRpcException (org.apache.xmlrpc.XmlRpcException)37 XenAPIException (com.xensource.xenapi.Types.XenAPIException)36 URI (java.net.URI)36 Connection (com.xensource.xenapi.Connection)34 SR (com.xensource.xenapi.SR)34 VDI (com.xensource.xenapi.VDI)34 CopyCmdAnswer (com.cloud.storage.command.CopyCmdAnswer)32 VolumeObjectTO (org.apache.cloudstack.storage.to.VolumeObjectTO)32 Answer (com.cloud.agent.api.Answer)29 IOException (java.io.IOException)28 File (java.io.File)27 PrimaryDataStoreTO (com.cloud.storage.to.PrimaryDataStoreTO)26