File tree Expand file tree Collapse file tree
@xen-orchestra/rest-api/src/srs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ export interface Xapi {
134134 nameLabel ?: string
135135 }
136136 ) : Promise < { vm : XenApiVmWrapped } >
137+ forgetSr ( id : XoSr [ 'id' ] ) : Promise < void >
137138 SR_importVdi (
138139 ref : XenApiSr [ '$ref' ] ,
139140 stream : Readable ,
Original file line number Diff line number Diff line change @@ -273,4 +273,31 @@ export class SrController extends XapiXoController<XoSr> {
273273 } ,
274274 } )
275275 }
276+
277+ /**
278+ * @example id "c4284e12-37c9-7967-b9e8-83ef229c3e03"
279+ */
280+ @Example ( taskLocation )
281+ @Post ( '{id}/actions/forget' )
282+ @SuccessResponse ( asynchronousActionResp . status , asynchronousActionResp . description )
283+ @Response ( noContentResp . status , noContentResp . description )
284+ @Response ( notFoundResp . status , notFoundResp . description )
285+ @Response ( invalidParametersResp . status , invalidParametersResp . description )
286+ @Response ( internalServerErrorResp . status , internalServerErrorResp . description )
287+ async forgetSr ( @Path ( ) id : string , @Query ( ) sync ?: boolean ) : CreateActionReturnType < void > {
288+ const srId = id as XoSr [ 'id' ]
289+ const action = async ( ) => {
290+ const xapiSr = this . getXapiObject ( srId )
291+ await xapiSr . $xapi . forgetSr ( srId )
292+ }
293+
294+ return this . createAction < void > ( action , {
295+ sync,
296+ statusCode : noContentResp . status ,
297+ taskProperties : {
298+ name : 'forget sr' ,
299+ objectId : srId ,
300+ } ,
301+ } )
302+ }
276303}
Original file line number Diff line number Diff line change 1515- [ Replication] Reuse the same VM as an incremental replication target (PR [ #9524 ] ( https://github.com/vatesfr/xen-orchestra/pull/9524 ) )
1616- [ S3] add configuration for max/minPartSize and maxPartNumber in the API (PR [ #9561 ] ( https://github.com/vatesfr/xen-orchestra/pull/9561 ) )
1717- [ REST API] Expose ` /rest/v0/vms/:id/actions/clone ` (PR [ #9453 ] ( https://github.com/vatesfr/xen-orchestra/pull/9453 ) )
18+ - [ REST API] Expose POST ` /rest/v0/srs/:id/actions/forget ` (PR [ #9505 ] ( https://github.com/vatesfr/xen-orchestra/pull/9505 ) )
1819
1920### Bug fixes
2021
You can’t perform that action at this time.
0 commit comments