Skip to content

Commit

Permalink
Add support for IPv6 address information (OpenNebula#247)
Browse files Browse the repository at this point in the history
Expose computed_ip6_global and computed_ip6_link next to computed_ip

Signed-off-by: Daniel Molkentin <daniel@molkentin.de>
  • Loading branch information
danimo committed Nov 9, 2023
1 parent 9cde785 commit c14f3ce
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions opennebula/resource_opennebula_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ func nicComputedVMFields() map[string]*schema.Schema {
Type: schema.TypeString,
Computed: true,
},
"computed_ip6_global": {
Type: schema.TypeString,
Computed: true,
},
"computed_ip6_link": {
Type: schema.TypeString,
Computed: true,
},
"computed_mac": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -890,6 +898,12 @@ func flattenVMNICComputed(NICConfig map[string]interface{}, NIC shared.NIC) map[
if len(NICConfig["ip"].(string)) > 0 {
NICMap["ip"] = NICMap["computed_ip"]
}
if len(NICConfig["ip6_global"].(string)) > 0 {
NICMap["ip6_global"] = NICMap["computed_ip6_global"]
}
if len(NICConfig["ip6_link"].(string)) > 0 {
NICMap["ip6_link"] = NICMap["computed_ip6_link"]
}
if len(NICConfig["mac"].(string)) > 0 {
NICMap["mac"] = NICMap["computed_mac"]
}
Expand Down
8 changes: 8 additions & 0 deletions opennebula/shared_schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,14 @@ func nicFields() map[string]*schema.Schema {
Type: schema.TypeString,
Optional: true,
},
"ip6_global": {
Type: schema.TypeString,
Optional: true,
},
"ip6_link": {
Type: schema.TypeString,
Optional: true,
},
"mac": {
Type: schema.TypeString,
Optional: true,
Expand Down

0 comments on commit c14f3ce

Please sign in to comment.