当前位置: 首页>>代码示例>>Java>>正文


Java StorageProfile.osDisk方法代码示例

本文整理汇总了Java中com.microsoft.azure.management.compute.StorageProfile.osDisk方法的典型用法代码示例。如果您正苦于以下问题:Java StorageProfile.osDisk方法的具体用法?Java StorageProfile.osDisk怎么用?Java StorageProfile.osDisk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.microsoft.azure.management.compute.StorageProfile的用法示例。


在下文中一共展示了StorageProfile.osDisk方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setOSDiskDefaults

import com.microsoft.azure.management.compute.StorageProfile; //导入方法依赖的package包/类
private void setOSDiskDefaults() {
    if (isInUpdateMode()) {
        return;
    }
    StorageProfile storageProfile = this.inner().storageProfile();
    OSDisk osDisk = storageProfile.osDisk();
    if (isOSDiskFromImage(osDisk)) {
        // ODDisk CreateOption: FROM_IMAGE
        //
        if (isManagedDiskEnabled()) {
            // Note:
            // Managed disk
            //     Supported: PlatformImage and CustomImage
            //     UnSupported: StoredImage
            //
            if (osDisk.managedDisk() == null) {
                osDisk.withManagedDisk(new ManagedDiskParametersInner());
            }
            if (osDisk.managedDisk().storageAccountType() == null) {
                osDisk.managedDisk()
                        .withStorageAccountType(StorageAccountTypes.STANDARD_LRS);
            }
            osDisk.withVhd(null);
            // We won't set osDisk.name() explicitly for managed disk, if it is null CRP generates unique
            // name for the disk resource within the resource group.
        } else {
            // Note:
            // Native (un-managed) disk
            //     Supported: PlatformImage and StoredImage
            //     UnSupported: CustomImage
            //
            if (isOSDiskFromPlatformImage(storageProfile)
                    || isOSDiskFromStoredImage(storageProfile)) {
                if (osDisk.vhd() == null) {
                    String osDiskVhdContainerName = "vhds";
                    String osDiskVhdName = this.vmName + "-os-disk-" + UUID.randomUUID().toString() + ".vhd";
                    withOSDiskVhdLocation(osDiskVhdContainerName, osDiskVhdName);
                }
                osDisk.withManagedDisk(null);
            }
            if (osDisk.name() == null) {
                withOSDiskName(this.vmName + "-os-disk");
            }
        }
    } else {
        // ODDisk CreateOption: ATTACH
        //
        if (isManagedDiskEnabled()) {
            // In case of attach, it is not allowed to change the storage account type of the
            // managed disk.
            //
            if (osDisk.managedDisk() != null) {
                osDisk.managedDisk().withStorageAccountType(null);
            }
            osDisk.withVhd(null);
        } else {
            osDisk.withManagedDisk(null);
            if (osDisk.name() == null) {
                withOSDiskName(this.vmName + "-os-disk");
            }
        }
    }
    if (osDisk.caching() == null) {
        withOSDiskCaching(CachingTypes.READ_WRITE);
    }
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:67,代码来源:VirtualMachineImpl.java

示例2: setOSProfileDefaults

import com.microsoft.azure.management.compute.StorageProfile; //导入方法依赖的package包/类
private void setOSProfileDefaults() {
    if (isInUpdateMode()) {
        return;
    }
    StorageProfile storageProfile = this.inner().storageProfile();
    OSDisk osDisk = storageProfile.osDisk();
    if (isOSDiskFromImage(osDisk)) {
        // ODDisk CreateOption: FROM_IMAGE
        //
        if (osDisk.osType() == OperatingSystemTypes.LINUX || this.isMarketplaceLinuxImage) {
            // linux image: PlatformImage | CustomImage | StoredImage
            //
            OSProfile osProfile = this.inner().osProfile();
            if (osProfile.linuxConfiguration() == null) {
                osProfile.withLinuxConfiguration(new LinuxConfiguration());
            }
            this.inner().osProfile()
                    .linuxConfiguration()
                    .withDisablePasswordAuthentication(osProfile.adminPassword() == null);
        }
        if (this.inner().osProfile().computerName() == null) {
            // VM name cannot contain only numeric values and cannot exceed 15 chars
            //
            if (vmName.matches("[0-9]+")) {
                this.inner().osProfile()
                        .withComputerName(SdkContext.randomResourceName("vm", 15));
            } else if (vmName.length() <= 15) {
                this.inner().osProfile()
                        .withComputerName(vmName);
            } else {
                this.inner().osProfile()
                        .withComputerName(SdkContext.randomResourceName("vm", 15));
            }
        }
    } else {
        // ODDisk CreateOption: ATTACH
        //
        // OS Profile must be set to null when an VM's OS disk is ATTACH-ed to a managed disk or
        // Specialized VHD
        //
        this.inner().withOsProfile(null);
    }
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:44,代码来源:VirtualMachineImpl.java

示例3: isOSDiskFromStoredImage

import com.microsoft.azure.management.compute.StorageProfile; //导入方法依赖的package包/类
/**
 * Checks whether the OS disk is based on a stored image ('captured' or 'bring your own feature').
 * <p>
 * A stored image is created by calling {@link VirtualMachine#capture(String, String, boolean)}.
 *
 * @param storageProfile the storage profile
 * @return true if the OS disk is configured to use custom image ('captured' or 'bring your own feature')
 */
private boolean isOSDiskFromStoredImage(StorageProfile storageProfile) {
    OSDisk osDisk = storageProfile.osDisk();
    return isOSDiskFromImage(osDisk)
            && osDisk.image() != null
            && osDisk.image().uri() != null;
}
 
开发者ID:Azure,项目名称:azure-libraries-for-java,代码行数:15,代码来源:VirtualMachineImpl.java


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