protected override void ProcessRecord() { GetSession(); if (Record != null) { NameLabel = Record.name_label; NameDescription = Record.name_description; PhysicalSize = Record.physical_size; Type = Record.type; ContentType = Record.content_type; Shared = Record.shared; SmConfig = CommonCmdletFunctions.ConvertDictionaryToHashtable(Record.sm_config); } else if (HashTable != null) { NameLabel = Marshalling.ParseString(HashTable, "name_label"); NameDescription = Marshalling.ParseString(HashTable, "name_description"); PhysicalSize = Marshalling.ParseLong(HashTable, "physical_size"); Type = Marshalling.ParseString(HashTable, "type"); ContentType = Marshalling.ParseString(HashTable, "content_type"); Shared = Marshalling.ParseBool(HashTable, "shared"); SmConfig = (Marshalling.ParseHashTable(HashTable, "sm_config")); } if (!ShouldProcess(session.Url, "SR.create")) { return; } RunApiCall(() => { var contxt = _context as XenServerCmdletDynamicParameters; if (contxt != null && contxt.Async) { taskRef = XenAPI.SR.async_create(session, XenHost, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(DeviceConfig), PhysicalSize, NameLabel, NameDescription, Type, ContentType, Shared, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(SmConfig)); if (PassThru) { XenAPI.Task taskObj = null; if (taskRef != "OpaqueRef:NULL") { taskObj = XenAPI.Task.get_record(session, taskRef.opaque_ref); taskObj.opaque_ref = taskRef.opaque_ref; } WriteObject(taskObj, true); } } else { string objRef = XenAPI.SR.create(session, XenHost, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(DeviceConfig), PhysicalSize, NameLabel, NameDescription, Type, ContentType, Shared, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(SmConfig)); if (PassThru) { XenAPI.SR obj = null; if (objRef != "OpaqueRef:NULL") { obj = XenAPI.SR.get_record(session, objRef); obj.opaque_ref = objRef; } WriteObject(obj, true); } } }); UpdateSessions(); }
protected override void ProcessRecord() { GetSession(); if (Record != null) { NameLabel = Record.name_label; NameDescription = Record.name_description; OtherConfig = CommonCmdletFunctions.ConvertDictionaryToHashtable(Record.other_config); } else if (HashTable != null) { NameLabel = Marshalling.ParseString(HashTable, "name_label"); NameDescription = Marshalling.ParseString(HashTable, "name_description"); OtherConfig = (Marshalling.ParseHashTable(HashTable, "other_config")); } if (!ShouldProcess(session.Url, "USB_group.create")) { return; } RunApiCall(() => { var contxt = _context as XenServerCmdletDynamicParameters; if (contxt != null && contxt.Async) { taskRef = XenAPI.USB_group.async_create(session, NameLabel, NameDescription, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(OtherConfig)); if (PassThru) { XenAPI.Task taskObj = null; if (taskRef != "OpaqueRef:NULL") { taskObj = XenAPI.Task.get_record(session, taskRef.opaque_ref); taskObj.opaque_ref = taskRef.opaque_ref; } WriteObject(taskObj, true); } } else { string objRef = XenAPI.USB_group.create(session, NameLabel, NameDescription, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(OtherConfig)); if (PassThru) { XenAPI.USB_group obj = null; if (objRef != "OpaqueRef:NULL") { obj = XenAPI.USB_group.get_record(session, objRef); obj.opaque_ref = objRef; } WriteObject(obj, true); } } }); UpdateSessions(); }
protected override void ProcessRecord() { GetSession(); if (Record != null) { Mode = Record.mode; Properties = CommonCmdletFunctions.ConvertDictionaryToHashtable(Record.properties); } else if (HashTable != null) { Mode = (bond_mode)CommonCmdletFunctions.EnumParseDefault(typeof(bond_mode), Marshalling.ParseString(HashTable, "mode")); Properties = (Marshalling.ParseHashTable(HashTable, "properties")); } if (!ShouldProcess(session.Url, "Bond.create")) { return; } RunApiCall(() => { var contxt = _context as XenServerCmdletDynamicParameters; if (contxt != null && contxt.Async) { taskRef = XenAPI.Bond.async_create(session, Network, Members, MAC, Mode, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(Properties)); if (PassThru) { XenAPI.Task taskObj = null; if (taskRef != "OpaqueRef:NULL") { taskObj = XenAPI.Task.get_record(session, taskRef.opaque_ref); taskObj.opaque_ref = taskRef.opaque_ref; } WriteObject(taskObj, true); } } else { string objRef = XenAPI.Bond.create(session, Network, Members, MAC, Mode, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(Properties)); if (PassThru) { XenAPI.Bond obj = null; if (objRef != "OpaqueRef:NULL") { obj = XenAPI.Bond.get_record(session, objRef); obj.opaque_ref = objRef; } WriteObject(obj, true); } } }); UpdateSessions(); }
protected override void ProcessRecord() { GetSession(); if (Record != null) { VM = Record.VM; GPUGroup = Record.GPU_group; Device = Record.device; OtherConfig = CommonCmdletFunctions.ConvertDictionaryToHashtable(Record.other_config); Type = Record.type; } else if (HashTable != null) { VM = Marshalling.ParseRef <VM>(HashTable, "VM"); GPUGroup = Marshalling.ParseRef <GPU_group>(HashTable, "GPU_group"); Device = Marshalling.ParseString(HashTable, "device"); OtherConfig = (Marshalling.ParseHashTable(HashTable, "other_config")); Type = Marshalling.ParseRef <VGPU_type>(HashTable, "type"); } if (!ShouldProcess(session.Url, "VGPU.create")) { return; } RunApiCall(() => { var contxt = _context as XenServerCmdletDynamicParameters; if (contxt != null && contxt.Async) { taskRef = XenAPI.VGPU.async_create(session, VM, GPUGroup, Device, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(OtherConfig), Type); if (PassThru) { XenAPI.Task taskObj = null; if (taskRef != "OpaqueRef:NULL") { taskObj = XenAPI.Task.get_record(session, taskRef.opaque_ref); taskObj.opaque_ref = taskRef.opaque_ref; } WriteObject(taskObj, true); } } else { string objRef = XenAPI.VGPU.create(session, VM, GPUGroup, Device, CommonCmdletFunctions.ConvertHashTableToDictionary <string, string>(OtherConfig), Type); if (PassThru) { XenAPI.VGPU obj = null; if (objRef != "OpaqueRef:NULL") { obj = XenAPI.VGPU.get_record(session, objRef); obj.opaque_ref = objRef; } WriteObject(obj, true); } } }); UpdateSessions(); }