Examples of NfsTO


Examples of com.cloud.agent.api.to.NfsTO

        DataStoreTO imageStore = destData.getDataStore();

        if (!(imageStore instanceof NfsTO)) {
            return backupSnapshotForObjectStore(cmd);
        }
        NfsTO nfsImageStore = (NfsTO) imageStore;

        String secondaryStoragePoolUrl = nfsImageStore.getUrl();
        // NOTE: snapshot name is encoded in snapshot path
        int index = snapshot.getPath().lastIndexOf("/");

        String snapshotName = snapshot.getPath().substring(index + 1);
        String volumePath = snapshot.getVolume().getPath();
View Full Code Here

Examples of com.cloud.agent.api.to.NfsTO

        TemplateObjectTO isoTO = (TemplateObjectTO) disk.getData();
        DataStoreTO store = isoTO.getDataStore();
        if (!(store instanceof NfsTO)) {
            return new AttachAnswer("unsupported protocol");
        }
        NfsTO nfsStore = (NfsTO) store;
        try {
            Connect conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName());
            attachOrDetachISO(conn, cmd.getVmName(), nfsStore.getUrl() + File.separator + isoTO.getPath(), true);
        } catch (LibvirtException e) {
            return new Answer(cmd, false, e.toString());
        } catch (URISyntaxException e) {
            return new Answer(cmd, false, e.toString());
        } catch (InternalErrorException e) {
View Full Code Here

Examples of com.cloud.agent.api.to.NfsTO

        TemplateObjectTO isoTO = (TemplateObjectTO) disk.getData();
        DataStoreTO store = isoTO.getDataStore();
        if (!(store instanceof NfsTO)) {
            return new AttachAnswer("unsupported protocol");
        }
        NfsTO nfsStore = (NfsTO) store;
        try {
            Connect conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName());
            attachOrDetachISO(conn, cmd.getVmName(), nfsStore.getUrl() + File.separator + isoTO.getPath(), false);
        } catch (LibvirtException e) {
            return new Answer(cmd, false, e.toString());
        } catch (URISyntaxException e) {
            return new Answer(cmd, false, e.toString());
        } catch (InternalErrorException e) {
View Full Code Here

Examples of com.cloud.agent.api.to.NfsTO

            if (!(imageStore instanceof NfsTO)) {
                return new CopyCmdAnswer("unsupported protocol");
            }

            NfsTO nfsImageStore = (NfsTO) imageStore;

            String snapshotFullPath = snapshot.getPath();
            int index = snapshotFullPath.lastIndexOf("/");
            String snapshotPath = snapshotFullPath.substring(0, index);
            String snapshotName = snapshotFullPath.substring(index + 1);
            KVMStoragePool secondaryPool = storagePoolMgr.getStoragePoolByURI(nfsImageStore.getUrl() + File.separator
                    + snapshotPath);
            KVMPhysicalDisk snapshotDisk = secondaryPool.getPhysicalDisk(snapshotName);

            if (volume.getFormat() == ImageFormat.RAW) {
                snapshotDisk.setFormat(PhysicalDiskFormat.RAW);
View Full Code Here

Examples of com.cloud.agent.api.to.NfsTO

        }

        if (srcDataStore.getRole() == DataStoreRole.ImageCache && destDataStore.getRole() == DataStoreRole.Image) {
            //need to take extra processing for vmware, such as packing to ova, before sending to S3
            if (srcData.getObjectType() == DataObjectType.VOLUME) {
                NfsTO cacheStore = (NfsTO)srcDataStore;
                String parentPath = storageResource.getRootDir(cacheStore.getUrl());
                VolumeObjectTO vol = (VolumeObjectTO)srcData;
                String path = vol.getPath();
                int index = path.lastIndexOf(File.separator);
                String name = path.substring(index + 1);
                storageManager.createOva(parentPath + File.separator + path, name);
                vol.setPath(path + File.separator + name + ".ova");
            } else if (srcData.getObjectType() == DataObjectType.SNAPSHOT && destData.getObjectType() == DataObjectType.TEMPLATE) {
                //create template from snapshot on src at first, then copy it to s3
                TemplateObjectTO cacheTemplate = (TemplateObjectTO)destData;
                cacheTemplate.setDataStore(srcDataStore);
                CopyCmdAnswer answer = (CopyCmdAnswer)processor.createTemplateFromSnapshot(cmd);
                if (!answer.getResult()) {
                    return answer;
                }
                cacheTemplate.setDataStore(destDataStore);
                TemplateObjectTO template = (TemplateObjectTO)answer.getNewData();
                template.setDataStore(srcDataStore);
                CopyCommand newCmd = new CopyCommand(template, destData, cmd.getWait(), cmd.executeInSequence());
                return storageResource.defaultAction(newCmd);
            }
            needDelegation = true;
        }

        if (srcData.getObjectType() == DataObjectType.SNAPSHOT && srcData.getDataStore().getRole() == DataStoreRole.Primary) {
            //for back up snapshot, we need to do backup to cache, then to object store if object store is used.
            if (cmd.getCacheTO() != null) {
                cmd.setDestTO(cmd.getCacheTO());

                CopyCmdAnswer answer = (CopyCmdAnswer)processor.backupSnapshot(cmd);
                if (!answer.getResult()) {
                    return answer;
                }
                NfsTO cacheStore = (NfsTO)cmd.getCacheTO().getDataStore();
                String parentPath = storageResource.getRootDir(cacheStore.getUrl());
                SnapshotObjectTO newSnapshot = (SnapshotObjectTO)answer.getNewData();
                String path = newSnapshot.getPath();
                int index = path.lastIndexOf(File.separator);
                String name = path.substring(index + 1);
                String dir = path.substring(0, index);
View Full Code Here

Examples of com.cloud.agent.api.to.NfsTO

        TemplateObjectTO template = (TemplateObjectTO)srcData;
        DataStoreTO srcStore = srcData.getDataStore();
        if (!(srcStore instanceof NfsTO)) {
            return new CopyCmdAnswer("unsupported protocol");
        }
        NfsTO nfsImageStore = (NfsTO)srcStore;
        DataTO destData = cmd.getDestTO();
        DataStoreTO destStore = destData.getDataStore();
        PrimaryDataStoreTO primaryStore = (PrimaryDataStoreTO)destStore;
        String secondaryStorageUrl = nfsImageStore.getUrl();
        assert (secondaryStorageUrl != null);

        String templateUrl = secondaryStorageUrl + "/" + srcData.getPath();

        Pair<String, String> templateInfo = VmwareStorageLayoutHelper.decodeTemplateRelativePathAndNameFromUrl(
View Full Code Here

Examples of com.cloud.agent.api.to.NfsTO

        VolumeObjectTO srcVolume = (VolumeObjectTO)cmd.getSrcTO();
        VolumeObjectTO destVolume = (VolumeObjectTO)cmd.getDestTO();
        VmwareContext context = hostService.getServiceContext(cmd);
        try {

            NfsTO srcStore = (NfsTO)srcVolume.getDataStore();
            PrimaryDataStoreTO destStore = (PrimaryDataStoreTO)destVolume.getDataStore();

            VmwareHypervisorHost hyperHost = hostService.getHyperHost(context, cmd);
            String uuid = destStore.getUuid();

            ManagedObjectReference morDatastore = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost, uuid);
            if (morDatastore == null) {
                morDatastore = hyperHost.mountDatastore(
                        false,
                        destStore.getHost(), 0, destStore.getPath(),
                        destStore.getUuid().replace("-", ""));

                if (morDatastore == null) {
                    throw new Exception("Unable to mount storage pool on host. storeUrl: " + destStore.getHost() + ":/" + destStore.getPath());
                }
            }

            Pair<String, String>  result = copyVolumeFromSecStorage(
                    hyperHost, srcVolume.getPath(),
                    new DatastoreMO(context, morDatastore),
                    srcStore.getUrl());
            deleteVolumeDirOnSecondaryStorage(result.first(), srcStore.getUrl());
            VolumeObjectTO newVolume = new VolumeObjectTO();
            newVolume.setPath(result.second());
            return new CopyCmdAnswer(newVolume);
        } catch (Throwable t) {
            if (t instanceof RemoteException) {
View Full Code Here

Examples of com.cloud.agent.api.to.NfsTO

        String vmName = srcVolume.getVmName();

        VmwareContext context = hostService.getServiceContext(cmd);
        try {
            PrimaryDataStoreTO primaryStorage = (PrimaryDataStoreTO)srcVolume.getDataStore();
            NfsTO destStore = (NfsTO)destVolume.getDataStore();
            VmwareHypervisorHost hyperHost = hostService.getHyperHost(context, cmd);

            Pair<String, String> result;

            result = copyVolumeToSecStorage(hostService,
                    hyperHost, cmd, vmName, primaryStorage.getUuid(), srcVolume.getPath(),destVolume.getPath(),
                    destStore.getUrl(),
                    hostService.getWorkerName(context, cmd, 0));
            VolumeObjectTO newVolume = new VolumeObjectTO();
            newVolume.setPath(result.first() + File.separator + result.second());
            return new CopyCmdAnswer(newVolume);
        } catch (Throwable e) {
View Full Code Here

Examples of com.cloud.agent.api.to.NfsTO

        DataStoreTO imageStore = template.getDataStore();

        if (!(imageStore instanceof NfsTO)) {
            return new CopyCmdAnswer("unsupported protocol");
        }
        NfsTO nfsImageStore = (NfsTO)imageStore;
        String secondaryStoragePoolURL = nfsImageStore.getUrl();
        String volumePath = volume.getPath();

        String details = null;

        VmwareContext context = hostService.getServiceContext(cmd);
View Full Code Here

Examples of com.cloud.agent.api.to.NfsTO

        try {
            if (!(imageStore instanceof  NfsTO)) {
                return new CopyCmdAnswer("Only support create template from snapshot, when the dest store is nfs");
            }

            NfsTO nfsSvr = (NfsTO)imageStore;
            Ternary<String, Long, Long> result = createTemplateFromSnapshot(template.getPath(),
                    uniqeName,
                    nfsSvr.getUrl(), snapshot.getPath(),
                    template.getId()
                    );

            TemplateObjectTO newTemplate = new TemplateObjectTO();
            newTemplate.setPath(result.first());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.