Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CP-49367 Implement xenserver_pif provider data source #18

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

acefei
Copy link
Member

@acefei acefei commented Jun 18, 2024

source .env && TF_ACC=1 go test ./xenserver/ -v   -timeout 120m
=== RUN   TestAccNetworkResource
--- PASS: TestAccNetworkResource (50.38s)
=== RUN   TestAccPifDataSource
--- PASS: TestAccPifDataSource (19.44s)
=== RUN   TestAccSRDataSource
--- PASS: TestAccSRDataSource (18.06s)
=== RUN   TestAccVMResource
--- PASS: TestAccVMResource (52.08s)
PASS
ok      terraform-provider-xenserver/xenserver  139.970s
pif_data_out = tolist([
  {
    "bond_master_of" = tolist([])
    "bond_slave_of" = "OpaqueRef:NULL"
    "capabilities" = tolist([
      "sriov",
    ])
    "currently_attached" = true
    "device" = "eth0"
    "disallow_unplug" = false
    "dns" = "10.71.56.11"
    "gateway" = "10.71.56.1"
    "host" = "OpaqueRef:041ade78-40d3-1ecd-3d3c-b7b7e91e4f76"
    "igmp_snooping_status" = "disabled"
    "ip" = "10.71.56.50"
    "ip_configuration_mode" = "DHCP"
    "ipv6" = tolist([])
    "ipv6_configuration_mode" = "None"
    "ipv6_gateway" = ""
    "mac" = "0c:c4:7a:e7:b5:e8"
    "managed" = true
    "management" = true
    "mtu" = 1500
    "netmask" = "255.255.248.0"
    "network" = "OpaqueRef:ce271ed2-87c5-ee24-0e71-0fead2417986"
    "other_config" = tomap({})
    "pci" = "OpaqueRef:a7e83bf8-0967-e886-818a-e259bda0d98e"
    "physical" = true
    "primary_address_type" = "IPv4"
    "properties" = tomap({
      "gro" = "on"
    })
    "sriov_logical_pif_of" = tolist([])
    "sriov_physical_pif_of" = tolist([])
    "tunnel_access_pif_of" = tolist([])
    "tunnel_transport_pif_of" = tolist([])
    "uuid" = "d9e981a6-7251-8794-7bbd-acb8662b9633"
    "vlan" = -1
    "vlan_master_of" = "OpaqueRef:NULL"
    "vlan_slave_of" = tolist([])
  },
])
vm_out = {
  "id" = "c43e9f42-c48d-2dce-19cd-2a2b7ba447ef"
  "name_label" = "Test CentOS VM"
  "other_config" = tomap({
    "flag" = "1"
  })
  "snapshots" = tolist([])
  "template_name" = "CentOS 7"
}

@acefei acefei requested review from xueqingz and xihuan-citrix June 18, 2024 07:54
@acefei acefei force-pushed the private/feis/CP-49367 branch from a2d5790 to 110f9b5 Compare June 18, 2024 07:55
@acefei acefei requested a review from JinyuZhou-patty June 18, 2024 07:55
// This description is used by the documentation generator and the language server.
MarkdownDescription: "PIF data source",

MarkdownDescription: "Provides information about a physical network interface (PIF) of XenServer",
Attributes: map[string]schema.Attribute{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is another key "management = true" in main.tf, but I didn't find in schema.

Copy link
Member Author

@acefei acefei Jun 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in line 47 and line 196

@xueqingz
Copy link
Collaborator

Could you also update the pif_data_source_test.go base on your changes, include the new fields.

@acefei
Copy link
Member Author

acefei commented Jun 18, 2024

Could you also update the pif_data_source_test.go base on your changes, include the new fields.

Sorry, I have no idea to add test for the new option network which is an uuid, I can't use the hard code for testing.

@acefei acefei force-pushed the private/feis/CP-49367 branch from 110f9b5 to 70c01ee Compare June 18, 2024 09:32
@acefei acefei force-pushed the private/feis/CP-49367 branch from 70c01ee to 76c720f Compare June 19, 2024 07:01
@acefei acefei force-pushed the private/feis/CP-49367 branch from 645de26 to 30c49c2 Compare June 19, 2024 09:01
- `capabilities` (List of String) Additional capabilities on the interface.
- `currently_attached` (Boolean) True if this interface is online
- `device` (String) The machine-readable name of the physical interface (PIF) (e.g. eth0)
- `disallow_unplug` (Boolean) Prevent this PIF from being unplugged; set this to notify the management tool-stack that the PIF has a special use and should not be unplugged under any circumstances (e.g. because you're running storage traffic over it)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see MD documents not exceeding 80 characters in line length such that reviews, diffs, and reading them in a terminal is supported.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a generated doc from Go, and it can't be broken up into multiple lines, but we can try to make it shorter.

@acefei acefei merged commit 0789c56 into xenserver:master Jun 19, 2024
2 checks passed
@acefei acefei deleted the private/feis/CP-49367 branch June 19, 2024 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants