-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CP-50592 [TF provider] Implement Pool Join
Signed-off-by: Fei Su <fei.su@cloud.com>
- Loading branch information
Showing
32 changed files
with
723 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
terraform import xenserver_pool.pool 00000000-0000-0000-0000-000000000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
resource "xenserver_sr_nfs" "nfs" { | ||
name_label = "NFS shared storage" | ||
name_description = "A test NFS storage repository" | ||
version = "3" | ||
storage_location = format("%s:%s", local.env_vars["NFS_SERVER"], local.env_vars["NFS_SERVER_PATH"]) | ||
} | ||
|
||
data "xenserver_pif" "pif" { | ||
device = "eth0" | ||
} | ||
|
||
data "xenserver_pif" "pif1" { | ||
device = "eth3" | ||
} | ||
|
||
locals { | ||
pif1_data = tomap({for element in data.xenserver_pif.pif1.data_items: element.uuid => element}) | ||
} | ||
|
||
resource "xenserver_pif_configure" "pif_update" { | ||
for_each = local.pif1_data | ||
uuid = each.key | ||
interface = { | ||
mode = "DHCP" | ||
} | ||
} | ||
|
||
# Configure default SR and Management Network of the pool | ||
resource "xenserver_pool" "pool" { | ||
name_label = "pool" | ||
default_sr = xenserver_sr_nfs.nfs.uuid | ||
management_network = data.xenserver_pif.pif.data_items[0].network | ||
} | ||
|
||
# Join supporter into the pool | ||
resource "xenserver_pool" "pool" { | ||
name_label = "pool" | ||
join_supporters = [ | ||
{ | ||
host = local.env_vars["SUPPORTER_HOST"] | ||
username = local.env_vars["SUPPORTER_USERNAME"] | ||
password = local.env_vars["SUPPORTER_PASSWORD"] | ||
} | ||
] | ||
} | ||
|
||
# Eject supporter from the pool | ||
data "xenserver_host" "supporter" { | ||
is_coordinator = false | ||
} | ||
|
||
resource "xenserver_pool" "pool" { | ||
name_label = "pool" | ||
eject_supporters = [ data.xenserver_host.supporter.data_items[1].uuid ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.