本文整理匯總了Java中com.huawei.esdk.fusioncompute.local.model.vm.ImportVmTempReq.setLocation方法的典型用法代碼示例。如果您正苦於以下問題:Java ImportVmTempReq.setLocation方法的具體用法?Java ImportVmTempReq.setLocation怎麽用?Java ImportVmTempReq.setLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.huawei.esdk.fusioncompute.local.model.vm.ImportVmTempReq
的用法示例。
在下文中一共展示了ImportVmTempReq.setLocation方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testImportTemplate
import com.huawei.esdk.fusioncompute.local.model.vm.ImportVmTempReq; //導入方法依賴的package包/類
@Test
public final void testImportTemplate()
{
String siteUri = "/service/sites/400E07BB";
ImportVmTempReq importVmTempReq = new ImportVmTempReq();
importVmTempReq.setLocation("urn:sites:400E07BB:hosts:119");
importVmTempReq.setName("df_eSDK_importTemp01");
importVmTempReq.setDescription("df");
importVmTempReq.setUrl("//110.168.10.188/share/exportTemp01/exportTemp01.xml");
importVmTempReq.setAutoBoot(false);
importVmTempReq.setUsername("dWX213051");
importVmTempReq.setPassword("[email protected]");
importVmTempReq.setIsTemplate(true);
OsOption osOption = new OsOption();
osOption.setOsType("Windows");
osOption.setOsVersion(25);
importVmTempReq.setOsOptions(osOption);
VmConfig vmConfig = new VmConfig();
CPU cpu = new CPU();
cpu.setQuantity(2);
cpu.setReservation(0);
cpu.setWeight(2000);
cpu.setLimit(0);
cpu.setCpuHotPlug(0);
Memory memory = new Memory();
memory.setQuantityMB(1024);
memory.setReservation(0);
memory.setWeight(10240);
Property properties = new Property();
properties.setIsAutoUpgrade(true);
properties.setIsEnableMemVol(true);
properties.setClockMode("freeClock");
List<Disk> disks = new ArrayList<Disk>();
Disk disk = new Disk();
disk.setQuantityGB(30);
disk.setSequenceNum(1);
disk.setDatastoreUrn("urn:sites:400E07BB:datastores:2");
disk.setIsDataCopy(true);
disk.setIsThin(false);
disk.setVolType(1);
disks.add(disk);
List<Nic> nics = new ArrayList<Nic>();
Nic nic = new Nic();
nic.setSequenceNum(1);
nic.setName("eth0");
nic.setPortGroupUrn("urn:sites:400E07BB:dvswitchs:1:portgroups:1");
nic.setVirtIo(0);
vmConfig.setCpu(cpu);
vmConfig.setMemory(memory);
vmConfig.setProperties(properties);
vmConfig.setDisks(disks);
vmConfig.setNics(nics);
importVmTempReq.setVmConfig(vmConfig);
FCSDKResponse<VRMTask> task = instance.importTemplate(siteUri, importVmTempReq);
System.out.println("error code:" + task.getErrorCode());
System.out.println("error des:" + task.getErrorDes());
System.out.println("urn:" + task.getResult().getUrn());
System.out.println("uri:" + task.getResult().getUri());
System.out.println("task urn:" + task.getResult().getTaskUrn());
System.out.println("task uri:" + task.getResult().getTaskUri());
}