use of org.ovirt.engine.api.v3.types.V3Actions in project ovirt-engine by oVirt.
the class V3TemplateHelper method fixDiskLinks.
/**
* Version 4 of the API can't reliably build the links for the "disks" collection because it has been removed,
* so we need to remove all the links and re-add them explicitly.
*/
public static void fixDiskLinks(String templateId, V3Disk disk) {
// Fix the link of the disk itself:
disk.setHref(V3LinkHelper.linkHref("templates", templateId, "disks", disk.getId()));
// Remove all the action links and add them again:
V3Actions actions = disk.getActions();
if (actions != null) {
List<V3Link> links = actions.getLinks();
links.clear();
V3LinkHelper.addLink(links, "copy", "templates", templateId, "disks", disk.getId(), "copy");
V3LinkHelper.addLink(links, "export", "templates", templateId, "disks", disk.getId(), "export");
}
}
use of org.ovirt.engine.api.v3.types.V3Actions in project ovirt-engine by oVirt.
the class V3VmHelper method fixDiskLinks.
/**
* Version 4 of the API can't reliably build the links for the "disks" collection because it has been removed,
* so we need to remove all the links and re-add them explicitly.
*/
public static void fixDiskLinks(String vmId, V3Disk disk) {
// Fix the link of the disk itself:
disk.setHref(V3LinkHelper.linkHref("vms", vmId, "disks", disk.getId()));
// Remove all the action links and add them again:
V3Actions actions = disk.getActions();
if (actions != null) {
List<V3Link> links = actions.getLinks();
links.clear();
V3LinkHelper.addLink(links, "activate", "vms", vmId, "disks", disk.getId(), "activate");
V3LinkHelper.addLink(links, "deactivate", "vms", vmId, "disks", disk.getId(), "deactivate");
V3LinkHelper.addLink(links, "export", "vms", vmId, "disks", disk.getId(), "export");
V3LinkHelper.addLink(links, "move", "vms", vmId, "disks", disk.getId(), "move");
}
// Remove all the links and add them again:
List<V3Link> links = disk.getLinks();
links.clear();
V3LinkHelper.addLink(links, "permissions", "vms", vmId, "disks", disk.getId(), "permissions");
V3LinkHelper.addLink(links, "statistics", "vms", vmId, "disks", disk.getId(), "statistics");
}