Show Table of Contents
2.12. 在子资源上进行操作
以下示例展示了如何修改子资源。在这个示例中,属于名为 'test' 的虚拟机的、名为 'test_Disk1' 的磁盘被激活。
过程 2.8. 在子资源上进行操作
- 声明需要进行操作的子资源所属资源的一个实例。
VM vm = api.getVMs().get("test"); - 声明子资源的一个实例:
VMDisk disk = vm.getDisks().get("test_Disk1"); - 声明要发送到子资源上的操作参数:
Action actionParam = new Action();
- 执行操作:
Action result = disk.activate(actionParam);

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.