3.4.5.2.32.9 IVdsVolume::Delete (Opnum 11)

The Delete method deletes all plexes in a volume.<118>

 HRESULT Delete(
   [in] long bForce
 );

bForce: A Boolean that determines whether all plexes in a volume are deleted when the volume is in use.

Return Values: The method MUST return zero or a non-error HRESULT (as specified in [MS-ERREF]) to indicate success, or return an implementation-specific nonzero error code to indicate failure. For the HRESULT values predefined by the Virtual Disk Service Remote Protocol, see section 2.2.3.

ERROR_SUCCESS (0x00000000)

When the server receives this message, it MUST perform the following:

  • Attempt to get exclusive access to the volume. If the server fails to get exclusive access to the volume, and the bForce parameter is not set to true, then the server MUST return VDS_E_DEVICE_IN_USE.

  • Delete all volume plexes in the volume. Remove the corresponding volume plex objects from the list of storage management objects.<119>

  • Remove this volume object from the list of storage management objects.

  • For each callback object that is registered in the list of callback objects, call the callback object's IVdsAdviseSink::OnNotify() method with a VDS_NOTIFICATION structure with the following attributes:

    • objectType member is VDS_NTT_VOLUME.

    • Volume member is a VDS_VOLUME_NOTIFICATION with the following attributes:

      • ulEvent is VDS_NF_VOLUME_DEPART.

      • volumeId is the VDS_OBJECT_ID of this volume.

      • plexId is NULL GUID, but it is not relevant when ulEvent is VDS_NF_VOLUME_DEPART.

      • ulPercentCompleted range is 0-100 and is implementation-specific; however, it is not relevant when ulEvent is VDS_NF_VOLUME_DEPART.

  • If the volume resided on a basic disk, for each callback object that is registered in the list of callback objects, call the callback object's IVdsAdviseSink::OnNotify() method with a VDS_NOTIFICATION structure with the following attributes:

    • objectType member is VDS_NTT_PARTITION.

    • Partition member is a VDS_PARTITION_NOTIFICATION with the following attributes:

      • ulEvent is VDS_NF_PARTITION_DEPART.

      • diskId is the VDS_OBJECT_ID of the disk object on which the volume resided.

      • ullOffset is the byte offset at which the volume's partition started on the disk.

  • If the volume resides on a basic disk and if the partition the volume resides on is the last remaining partition in an extended partition, delete the extended partition as well. Then for each callback object registered in the list of callback objects, call the callback object's IVdsAdviseSink::OnNotify() method with a VDS_NOTIFICATION structure with the following attributes:

    • objectType member is VDS_NTT_PARTITION.

    • Partition member is a VDS_PARTITION_NOTIFICATION with the following attributes:

      • ulEvent is VDS_NF_PARTITION_DEPART.

      • diskId is the VDS_OBJECT_ID of the disk object on which the extended partition resided.

      • ullOffset is the byte offset at which the extended partition started on the disk.

  • If the volume resided on a basic disk, for each callback object registered in the list of callback objects, call the callback object's IVdsAdviseSink::OnNotify() method with a VDS_NOTIFICATION structure with the following attributes:

    • objectType member is VDS_NTT_DISK.

    • Disk member is a VDS_DISK_NOTIFICATION with the following attributes:

      • ulEvent is VDS_NF_DISK_MODIFY.

      • diskId is the VDS_OBJECT_ID of the disk object on which the volume resided.

  • Return an HRESULT indicating failure or success.