• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DataDisk类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.microsoft.azure.management.compute.DataDisk的典型用法代码示例。如果您正苦于以下问题:Java DataDisk类的具体用法?Java DataDisk怎么用?Java DataDisk使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DataDisk类属于com.microsoft.azure.management.compute包,在下文中一共展示了DataDisk类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: wrapModel

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
@Override
protected VirtualMachineImpl wrapModel(String name) {
    VirtualMachineInner inner = new VirtualMachineInner();
    inner.withStorageProfile(new StorageProfile()
            .withOsDisk(new OSDisk())
            .withDataDisks(new ArrayList<DataDisk>()));
    inner.withOsProfile(new OSProfile());
    inner.withHardwareProfile(new HardwareProfile());
    inner.withNetworkProfile(new NetworkProfile()
            .withNetworkInterfaces(new ArrayList<NetworkInterfaceReferenceInner>()));
    return new VirtualMachineImpl(name,
            inner,
            this.manager(),
            this.storageManager,
            this.networkManager,
            this.rbacManager);
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:18,代码来源:VirtualMachinesImpl.java


示例2: initializeDataDisks

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
private void initializeDataDisks() {
    if (this.inner().storageProfile().dataDisks() == null) {
        this.inner()
                .storageProfile()
                .withDataDisks(new ArrayList<DataDisk>());
    }

    this.isUnmanagedDiskSelected = false;
    this.managedDataDisks.clear();
    this.unmanagedDataDisks = new ArrayList<>();
    if (!isManagedDiskEnabled()) {
        for (DataDisk dataDiskInner : this.storageProfile().dataDisks()) {
            this.unmanagedDataDisks.add(new UnmanagedDataDiskImpl(dataDiskInner, this));
        }
    }
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:17,代码来源:VirtualMachineImpl.java


示例3: setAttachableNewDataDisks

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
private void setAttachableNewDataDisks(Func0<Integer> nextLun) {
    List<DataDisk> dataDisks = vm.inner().storageProfile().dataDisks();
    for (Map.Entry<String, DataDisk> entry : this.newDisksToAttach.entrySet()) {
        Disk managedDisk = vm.<Disk>taskResult(entry.getKey());
        DataDisk dataDisk = entry.getValue();
        dataDisk.withCreateOption(DiskCreateOptionTypes.ATTACH);
        if (dataDisk.lun() == -1) {
            dataDisk.withLun(nextLun.call());
        }
        dataDisk.withManagedDisk(new ManagedDiskParametersInner());
        dataDisk.managedDisk().withId(managedDisk.id());
        if (dataDisk.caching() == null) {
            dataDisk.withCaching(getDefaultCachingType());
        }
        // Don't set default storage account type for the attachable managed disks, it is already
        // defined in the managed disk and not allowed to change.
        dataDisk.withName(null);
        dataDisks.add(dataDisk);
    }
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:21,代码来源:VirtualMachineImpl.java


示例4: setAttachableExistingDataDisks

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
private void setAttachableExistingDataDisks(Func0<Integer> nextLun) {
    List<DataDisk> dataDisks = vm.inner().storageProfile().dataDisks();
    for (DataDisk dataDisk : this.existingDisksToAttach) {
        dataDisk.withCreateOption(DiskCreateOptionTypes.ATTACH);
        if (dataDisk.lun() == -1) {
            dataDisk.withLun(nextLun.call());
        }
        if (dataDisk.caching() == null) {
            dataDisk.withCaching(getDefaultCachingType());
        }
        // Don't set default storage account type for the attachable managed disks, it is already
        // defined in the managed disk and not allowed to change.
        dataDisk.withName(null);
        dataDisks.add(dataDisk);
    }
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:17,代码来源:VirtualMachineImpl.java


示例5: setImplicitDataDisks

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
private void setImplicitDataDisks(Func0<Integer> nextLun) {
    List<DataDisk> dataDisks = vm.inner().storageProfile().dataDisks();
    for (DataDisk dataDisk : this.implicitDisksToAssociate) {
        dataDisk.withCreateOption(DiskCreateOptionTypes.EMPTY);
        if (dataDisk.lun() == -1) {
            dataDisk.withLun(nextLun.call());
        }
        if (dataDisk.caching() == null) {
            dataDisk.withCaching(getDefaultCachingType());
        }
        if (dataDisk.managedDisk() == null) {
            dataDisk.withManagedDisk(new ManagedDiskParametersInner());
        }
        if (dataDisk.managedDisk().storageAccountType() == null) {
            dataDisk.managedDisk().withStorageAccountType(getDefaultStorageAccountType());
        }
        dataDisk.withName(null);
        dataDisks.add(dataDisk);
    }
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:21,代码来源:VirtualMachineImpl.java


示例6: unmanagedDataDisks

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
@Override
public Map<Integer, VirtualMachineUnmanagedDataDisk> unmanagedDataDisks() {
    Map<Integer, VirtualMachineUnmanagedDataDisk> dataDisks = new HashMap<>();
    if (!isManagedDiskEnabled()) {
        List<DataDisk> innerDataDisks = this.inner().storageProfile().dataDisks();
        if (innerDataDisks != null) {
            for (DataDisk innerDataDisk : innerDataDisks) {
                dataDisks.put(innerDataDisk.lun(), new UnmanagedDataDiskImpl(innerDataDisk, null));
            }
        }
    }
    return Collections.unmodifiableMap(dataDisks);
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:14,代码来源:VirtualMachineScaleSetVMImpl.java


示例7: withNewDataDisk

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
@Override
public VirtualMachineImpl withNewDataDisk(Creatable<Disk> creatable) {
    throwIfManagedDiskDisabled(ManagedUnmanagedDiskErrors.VM_BOTH_UNMANAGED_AND_MANAGED_DISK_NOT_ALLOWED);
    this.managedDataDisks.newDisksToAttach.put(this.addDependency(creatable),
            new DataDisk().withLun(-1));
    return this;
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:8,代码来源:VirtualMachineImpl.java


示例8: withExistingDataDisk

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
@Override
public VirtualMachineImpl withExistingDataDisk(Disk disk) {
    throwIfManagedDiskDisabled(ManagedUnmanagedDiskErrors.VM_BOTH_UNMANAGED_AND_MANAGED_DISK_NOT_ALLOWED);
    ManagedDiskParametersInner managedDiskParameters = new ManagedDiskParametersInner();
    managedDiskParameters.withId(disk.id());
    this.managedDataDisks.existingDisksToAttach.add(new DataDisk()
            .withLun(-1)
            .withManagedDisk(managedDiskParameters));
    return this;
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:11,代码来源:VirtualMachineImpl.java


示例9: withNewDataDiskFromImage

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
@Override
public VirtualMachineImpl withNewDataDiskFromImage(int imageLun, int newSizeInGB, CachingTypes cachingType) {
    this.managedDataDisks.newDisksFromImage.add(new DataDisk()
            .withLun(imageLun)
            .withDiskSizeGB(newSizeInGB)
            .withCaching(cachingType));
    return this;
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:9,代码来源:VirtualMachineImpl.java


示例10: setImageBasedDataDisks

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
private void setImageBasedDataDisks() {
    List<DataDisk> dataDisks = vm.inner().storageProfile().dataDisks();
    for (DataDisk dataDisk : this.newDisksFromImage) {
        dataDisk.withCreateOption(DiskCreateOptionTypes.FROM_IMAGE);
        // Don't set default storage account type for the disk, either user has to specify it explicitly or let
        // CRP pick it from the image
        dataDisk.withName(null);
        dataDisks.add(dataDisk);
    }
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:11,代码来源:VirtualMachineImpl.java


示例11: removeDataDisks

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
private void removeDataDisks() {
    List<DataDisk> dataDisks = vm.inner().storageProfile().dataDisks();
    for (Integer lun : this.diskLunsToRemove) {
        int indexToRemove = 0;
        for (DataDisk dataDisk : dataDisks) {
            if (dataDisk.lun() == lun) {
                dataDisks.remove(indexToRemove);
                break;
            }
            indexToRemove++;
        }
    }
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:14,代码来源:VirtualMachineImpl.java


示例12: prepareDataDisk

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
protected static UnmanagedDataDiskImpl prepareDataDisk(String name,
                                                       VirtualMachineImpl parent) {
    DataDisk dataDiskInner = new DataDisk();
    dataDiskInner.withLun(-1)
            .withName(name)
            .withVhd(null);
    return new UnmanagedDataDiskImpl(dataDiskInner, parent);
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:9,代码来源:UnmanagedDataDiskImpl.java


示例13: createDataDiskState

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
private DiskState createDataDiskState(EnumerationContext ctx, DataDisk dataDisk, boolean isManaged) {
    DiskState diskState = new DiskState();
    String id = UUID.randomUUID().toString();
    diskState.documentSelfLink = UriUtils.buildUriPath(DiskService.FACTORY_LINK, id);
    diskState.name = dataDisk.name();
    if (isManaged) {
        diskState.id = dataDisk.managedDisk().id();
    } else {
        diskState.id = AzureUtils.canonizeId(dataDisk.vhd().uri());
    }
    diskState.capacityMBytes = dataDisk.diskSizeGB() * 1024;
    diskState.status = DiskService.DiskStatus.ATTACHED;
    diskState.tenantLinks = ctx.parentCompute.tenantLinks;
    diskState.resourcePoolLink = ctx.request.resourcePoolLink;
    diskState.computeHostLink = ctx.parentCompute.documentSelfLink;
    diskState.endpointLink = ctx.request.endpointLink;
    AdapterUtils.addToEndpointLinks(diskState, ctx.request.endpointLink);

    diskState.customProperties = new HashMap<>();
    diskState.customProperties.put(AZURE_DATA_DISK_CACHING, dataDisk.caching().name());
    diskState.customProperties.put(DISK_CONTROLLER_NUMBER, String.valueOf(dataDisk.lun()));

    diskState.customProperties.put(AZURE_MANAGED_DISK_TYPE,
            dataDisk.managedDisk().storageAccountType().toString());

    return diskState;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:28,代码来源:AzureComputeEnumerationAdapterService.java


示例14: VirtualMachineDataDiskImpl

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
VirtualMachineDataDiskImpl(DataDisk dataDiskInner) {
    super(dataDiskInner);
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:4,代码来源:VirtualMachineDataDiskImpl.java


示例15: UnmanagedDataDiskImpl

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
protected UnmanagedDataDiskImpl(DataDisk inner, VirtualMachineImpl parent) {
    super(inner, parent);
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:4,代码来源:UnmanagedDataDiskImpl.java


示例16: createDiskToUpdate

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
/**
 * Creates and returns a new diskState object which is updated with id, LUN, status and documentSelfLink
 */
private DeferredResult<Operation> createDiskToUpdate(AzureInstanceContext ctx, Optional<DiskState> diskOpt,
                                                     DataDisk azureDataDisk) {
    // update VHD uri or disk id respectively for un-managed and managed disks
    DiskState diskState = diskOpt.get();
    final DiskState diskStateToUpdate = new DiskState();
    diskStateToUpdate.documentSelfLink = diskState.documentSelfLink;

    if (ctx.useManagedDisks()) {
        diskStateToUpdate.id = azureDataDisk.managedDisk().id();
    } else {
        diskStateToUpdate.id = azureDataDisk.vhd().uri();
    }

    // The LUN value of disk
    if (diskStateToUpdate.customProperties == null) {
        diskStateToUpdate.customProperties = new HashMap<>();
    }
    diskStateToUpdate.customProperties.put(DISK_CONTROLLER_NUMBER, String.valueOf(azureDataDisk.lun()));

    diskStateToUpdate.status = DiskService.DiskStatus.ATTACHED;

    Operation updateDiskState = Operation
            .createPatch(ctx.service, diskStateToUpdate.documentSelfLink)
            .setBody(diskStateToUpdate);

    DeferredResult<Operation> updateDR = ctx.service.sendWithDeferredResult(updateDiskState)
            .whenComplete((op, exc) -> {
                if (exc != null) {
                    logSevere(() -> String.format(
                            "Updating data DiskState [%s] with VHD URI [%s]: FAILED with %s",
                            diskState.name, diskStateToUpdate.id, Utils.toString(exc)));

                } else {
                    logFine(() -> String.format(
                            "Updating data DiskState [%s] with VHD URI [%s]: SUCCESS",
                            diskState.name, diskStateToUpdate.id));
                }
            });

    return updateDR;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:45,代码来源:AzureInstanceService.java


示例17: updateDiskState

import com.microsoft.azure.management.compute.DataDisk; //导入依赖的package包/类
/**
 * Update status and LUN of DiskState
 */
private DeferredResult<Operation> updateDiskState(AzureComputeDiskDay2Context context) {
    DiskState diskState = context.diskState;

    if (context.request.operation.equals(ResourceOperation.ATTACH_DISK.operation)) {
        diskState.status = DiskService.DiskStatus.ATTACHED;
    } else if (context.request.operation.equals(ResourceOperation.DETACH_DISK.operation)) {
        diskState.status = DiskService.DiskStatus.AVAILABLE;
        diskState.customProperties.remove(DISK_CONTROLLER_NUMBER);
    }

    if (!context.request.isMockRequest) {
        DataDisk dataDisk = context.provisionedVm.inner().storageProfile().dataDisks()
                .stream()
                .filter(dd -> diskState.name.equalsIgnoreCase(dd.name()))
                .findFirst()
                .orElse(null);

        if (dataDisk != null) {
            if (diskState.customProperties == null) {
                diskState.customProperties = new HashMap<>();
            }
            diskState.customProperties.put(DISK_CONTROLLER_NUMBER,
                    String.valueOf(dataDisk.lun()));
        }
    }

    Operation diskPatchOp = null;

    if (context.request.operation.equals(ResourceOperation.ATTACH_DISK.operation)) {
        diskPatchOp = Operation
                .createPatch(UriUtils.buildUri(this.getHost(), diskState.documentSelfLink))
                .setBody(diskState)
                .setReferer(this.getUri());
    } else if (context.request.operation.equals(ResourceOperation.DETACH_DISK.operation)) {
        diskPatchOp = Operation
                .createPut(UriUtils.buildUri(this.getHost(), diskState.documentSelfLink))
                .setBody(diskState)
                .setReferer(this.getUri());
    }

    return this.sendWithDeferredResult(diskPatchOp);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:46,代码来源:AzureComputeDiskDay2Service.java



注:本文中的com.microsoft.azure.management.compute.DataDisk类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GeoJSONReader类代码示例发布时间:2022-05-22
下一篇:
Java SwornPlugin类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap