IVdsSubSystemIscsi::CreateTarget method (vds.h)

[Beginning with Windows 8 and Windows Server 2012, the Virtual Disk Service COM interface is superseded by the Windows Storage Management API.]

Creates an iSCSI target. The interface pointer for the new target object can be retrieved by calling IVdsAsync::Wait through the ppAsync parameter. The VDS_ASYNC_OUTPUT structure returned contains the target object interface pointer in the ct.pTargetUnk member.

Syntax

HRESULT CreateTarget(
  [in]  LPWSTR    pwszIscsiName,
  [in]  LPWSTR    pwszFriendlyName,
  [out] IVdsAsync **ppAsync
);

Parameters

[in] pwszIscsiName

A string specifying the iSCSI name to assign to the target. The target name must be unique across all targets in all subsystems visible on the network.

If pwszIscsiName is NULL or points to an empty string, the provider will generate the iSCSI name to assign to the target.

[in] pwszFriendlyName

A string specifying the friendly name to assign to the target. This corresponds to the iSCSI alias.

[out] ppAsync

The address of an IVdsAsync interface pointer, which VDS initializes on return. Callers must release the interface. Use this interface to cancel, wait for, or query the status of the operation. If you call IVdsAsync::Wait on this method and a success HRESULT value is returned, you must release the interfaces returned in the VDS_ASYNC_OUTPUT structure by calling the IUnknown::Release method on each interface pointer. However, if Wait returns a failure HRESULT value, or if the pHrResult parameter of Wait receives a failure HRESULT value, the interface pointers in the VDS_ASYNC_OUTPUT structure are NULL and do not need to be released. You can test for success or failure HRESULT values by using the SUCCEEDED and FAILED macros defined in Winerror.h.

Return value

This method can return standard HRESULT values, such as E_INVALIDARG or E_OUTOFMEMORY, and VDS-specific return values. It can also return converted system error codes using the HRESULT_FROM_WIN32 macro. Errors can originate from VDS itself or from the underlying VDS provider that is being used. Possible return values include the following.

Return code/value Description
S_OK
The target was created successfully.
VDS_E_NOT_SUPPORTED
0x80042400L
The subsystem object does not support this method. This indicates that the hardware provider has set the VDS_SF_SUPPORTS_SIMPLE_TARGET_CONFIG flag in the ulFlags member of the VDS_SUB_SYSTEM_PROP structure for the subsystem object.
VDS_E_PROVIDER_CACHE_CORRUPT
0x8004241FL
The cache of the provider is corrupted. This indicates a software or communication problem inside a provider that caches information about the attached devices. The caller can use the IVdsHwProvider::Reenumerate method followed by the IVdsHwProvider::Refresh method to restore the cache.
VDS_E_OBJECT_DELETED
0x8004240BL
The subsystem object is no longer present.
VDS_E_OBJECT_STATUS_FAILED
0x80042431L
The subsystem is in a failed state and is unable to perform the requested operation.
VDS_E_ANOTHER_CALL_IN_PROGRESS
0x80042404L
Another operation is in progress. This operation cannot proceed until previous operations are complete.
VDS_E_NAME_NOT_UNIQUE
0x80042701L
A non-unique name was specified in the pwszIscsiName parameter.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 R2 [desktop apps only]
Target Platform Windows
Header vds.h
Library Uuid.lib
Redistributable VDS 1.1

See also

IVdsAsync

IVdsLunIscsi::AssociateTargets

IVdsSubSystem::GetProperties

IVdsSubSystemIscsi

VDS_ASYNC_OUTPUT

VDS_SUB_SYSTEM_FLAG

VDS_SUB_SYSTEM_PROP