New-XenSR
Creates a new SR object.
Syntax
New-XenSR -HashTable <hashtable> [-PassThru] [-BestEffort] [-SessionOpaqueRef <string>]
[-WhatIf] [-Confirm] [-Async] [<CommonParameters>]
New-XenSR -Record <SR> [-PassThru] [-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf]
[-Confirm] [-Async] [<CommonParameters>]
New-XenSR [-PassThru] [-XenHost <XenRef[Host]>] [-DeviceConfig <hashtable>]
[-PhysicalSize <long>] [-NameLabel <string>] [-NameDescription <string>]
[-Type <string>] [-ContentType <string>] [-Shared <bool>] [-SmConfig <hashtable>]
[-BestEffort] [-SessionOpaqueRef <string>] [-WhatIf] [-Confirm] [-Async]
[<CommonParameters>]
Description
Creates a new SR object.
SR.create: Create a new Storage Repository and introduce it into the managed system, creating both SR record and PBD record to attach it to current host (with specified device\_config parameters).
SR: A storage repository.
Parameters
-Async
If set, the operation runs asynchronously and returns a Task object that can be used to track its progress.
| Attribute | Value |
|---|---|
| Type | SwitchParameter |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
-BestEffort
If set, the cmdlet continues processing further objects instead of throwing a terminating error when an operation fails for one object.
| Attribute | Value |
|---|---|
| Type | SwitchParameter |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
-Confirm
Prompts for confirmation before running the cmdlet.
| Attribute | Value |
|---|---|
| Type | SwitchParameter |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
| Aliases | cf |
-ContentType
The type of the new SRs content, if required (for example, ISOs)
| Attribute | Value |
|---|---|
| Type | string |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
-DeviceConfig
The device config string that will be passed to backend SR driver
| Attribute | Value |
|---|---|
| Type | hashtable |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
-HashTable
A hashtable of field names to values, from which to create the SR.
| Attribute | Value |
|---|---|
| Type | hashtable |
| Required | True |
| Position | Named |
| Accepts pipeline input | False |
-NameDescription
The description of the new storage repository
| Attribute | Value |
|---|---|
| Type | string |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
-NameLabel
The name of the new storage repository
| Attribute | Value |
|---|---|
| Type | string |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
-PassThru
If set, the cmdlet returns the affected object. By default the cmdlet does not generate any output.
| Attribute | Value |
|---|---|
| Type | SwitchParameter |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
-PhysicalSize
The physical size of the new storage repository
| Attribute | Value |
|---|---|
| Type | long |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
-Record
An existing SR record whose fields are used to create the new object.
| Attribute | Value |
|---|---|
| Type | SR |
| Required | True |
| Position | Named |
| Accepts pipeline input | False |
-SessionOpaqueRef
The session object on which to run the cmdlet. This overrides the default session and lets you target a specific open XenServer connection.
| Attribute | Value |
|---|---|
| Type | string |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
-SmConfig
Storage backend specific configuration options
| Attribute | Value |
|---|---|
| Type | hashtable |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
-Type
The type of the SR; used to specify the SR backend driver to use
| Attribute | Value |
|---|---|
| Type | string |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
| Attribute | Value |
|---|---|
| Type | SwitchParameter |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
| Aliases | wi |
-XenHost
The host to create/make the SR on
| Attribute | Value |
|---|---|
| Type | XenRef[Host] |
| Required | False |
| Position | Named |
| Accepts pipeline input | False |
Inputs
-
None
Outputs
-
SR -
Task -
void
Examples
Example 1: Create an SR
PS> $xenHost = Get-XenHost | Select-Object -First 1
PS> New-XenSR -XenHost $xenHost -DeviceConfig @{ "key" = "value" } -PhysicalSize 0 -NameLabel "value" -NameDescription "value" -Type "value" -ContentType "value" -Shared $true -SmConfig @{ "key" = "value" } -PassThru
New-XenSR takes the arguments of the create call rather than a record of fields, and needs all of them. -PassThru returns the new SR.
Example 2: Create an SR and wait for the task
PS> $xenHost = Get-XenHost | Select-Object -First 1
PS> New-XenSR -XenHost $xenHost -DeviceConfig @{ "key" = "value" } -PhysicalSize 0 -NameLabel "value" -NameDescription "value" -Type "value" -ContentType "value" -Shared $true -SmConfig @{ "key" = "value" } -Async -PassThru |
Wait-XenTask -ShowProgress
-Async hands the work to the server and returns the Task that represents it, which pipes into Wait-XenTask.
Example 3: See what would be created
PS> $xenHost = Get-XenHost | Select-Object -First 1
PS> New-XenSR -XenHost $xenHost -DeviceConfig @{ "key" = "value" } -PhysicalSize 0 -NameLabel "value" -NameDescription "value" -Type "value" -ContentType "value" -Shared $true -SmConfig @{ "key" = "value" } -WhatIf
Reports what would be created without creating it. Every cmdlet that changes the server takes -WhatIf and -Confirm.
Related links
-
Class: SR
-
Using the XenServer PowerShell module