/// <summary> /// Create a VBD /// /// ** vbd.bootable ** /// 1. Windows ignores bootable flag /// 2. Eliloader changes the device "0" to bootable when booting linux /// </summary> /// <param name="disk"></param> /// <param name="vdi"></param> /// <param name="progress1"></param> /// <param name="progress2"></param> /// <param name="bootable">Set VBD.bootable to this value - see comments above</param> private void CreateVbd(DiskDescription disk, VDI vdi, double progress1, double progress2, bool bootable) { List <string> devices = AllowedVBDs; if (devices.Count == 0) { throw new Exception(Messages.NO_MORE_USERDEVICES); } VBD vbd = new VBD(); vbd.SetIsOwner(true); vbd.bootable = bootable; vbd.empty = false; vbd.unpluggable = true; vbd.mode = vbd_mode.RW; vbd.type = vbd_type.Disk; vbd.userdevice = devices.Contains(disk.Device.userdevice) ? disk.Device.userdevice : devices[0]; vbd.device = ""; vbd.VM = new XenRef <VM>(VM.opaque_ref); vbd.VDI = new XenRef <VDI>(vdi.opaque_ref); RelatedTask = VBD.async_create(Session, vbd); PollToCompletion(progress1, progress2); Connection.WaitForCache(new XenRef <VBD>(Result)); }
private VBD CreateCdDrive() { List <string> devices = AllowedVBDs; if (devices.Count == 0) { throw new Exception(Messages.NO_MORE_USERDEVICES); } VBD vbd = new VBD { bootable = InsMethod == InstallMethod.CD, empty = true, unpluggable = true, mode = vbd_mode.RO, type = vbd_type.CD, userdevice = devices.Contains("3") ? "3" : devices[0], VM = new XenRef <VM>(VM.opaque_ref) }; RelatedTask = VBD.async_create(Session, vbd); PollToCompletion(60, 65); return(Connection.WaitForCache(new XenRef <VBD>(Result))); }