Show Table of Contents
2.11. 修改子资源
以下示例展示了如何修改子资源。在这个示例中,属于名为 'test' 的虚拟机的、名为 'test_Disk1' 的磁盘被改名为 'test_Disk1_updated'。
过程 2.7. 更新子资源
- 声明一个需要被更改的子资源所属资源的实例。
VM vm = api.getVMs().get("test"); - 声明需要被更改的子资源的实例:
VMDisk disk = vm.getDisks().get("test_Disk1"); - 为属性设置新的值:
disk.setAlias("test_Disk1_updated"); - 更新子资源:
VMDisk updateDisk = disk.update();

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.