/** * Add disk if it does not exist to a given vm * * @param disk the disk to add * @param vmId the ID of the vm to add to if the disk does not exist for this VM */ public static void addDiskToVmIfNotExists(BaseDisk disk, Guid vmId) { if (!DbFacade.getInstance().getBaseDiskDao().exists(disk.getId())) { addDiskToVm(disk, vmId); } }
/** * Adds disk to vm * * @param disk the disk to add * @param vmId the ID of the VM to add to */ public static void addDiskToVm(BaseDisk disk, Guid vmId) { DbFacade.getInstance().getBaseDiskDao().save(disk); VmDeviceUtils.addDiskDevice(vmId, disk.getId()); }
/** * Adds disk to a VM without creating a VmDevice entry * * @param disk disk to add */ public static void addDisk(BaseDisk disk) { if (!DbFacade.getInstance().getBaseDiskDao().exists(disk.getId())) { DbFacade.getInstance().getBaseDiskDao().save(disk); } }