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

Improve AIX Support #1651

Merged
merged 23 commits into from
May 27, 2024
Merged

Improve AIX Support #1651

merged 23 commits into from
May 27, 2024

Conversation

Dylan-M
Copy link
Contributor

@Dylan-M Dylan-M commented May 18, 2024

Implement additional AIX support

I have very little Golang experience.
So... please point out anything I'm doing wrong from Golang perspective
Also anything I can do to improve efficiency of some of the things I had to do as loops to pick something out of several lines.
Or really, anything else. I don't take offense, unless you're rude about it. Constructive criticism is always welcome.

This should now support all packages except process, which I don't have the time to develop (process is very in-depth)

Added:

  • CPU Package: Support for percpu
  • CPU Package: Support additional fields
  • Host Package: Add AIX support
  • Disk Package: Add support for nocgo

Partially addresses #1490

…commit).

Version set properly to 1.18, which is the new minimum needed for changes in this branch.
Run go mod tidy again with version set back to 1.18.
@Dylan-M
Copy link
Contributor Author

Dylan-M commented May 21, 2024

@shirou If you're at all concerned about AIX support, I'm willing to be a code owner for the AIX portions only to help alleviate that. Alternatively, I can help you get set up with an emulated AIX system to work from.

Copy link
Owner

@shirou shirou left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! I haven't actually run it, but it looks fine at first glance, with some nit comments. If there are any issues on AIX, someone will likely open an issue for it. This is how we've handled other architectures in the past.

Unrelated to this PR, but for my future reference, could you let me know the best way to set up an AIX emulation environment? Would QEMU be a good option?

Comment on lines +16 to +23
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Copy link
Owner

Choose a reason for hiding this comment

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

Do those required need to be added to the go.mod file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You'll likely know better than I do. I simply rand go mod tidy and went with what go itself says.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried removing them, and running go mod tidy again. It readded them. So golang thinks they need to be there.

@@ -1,6 +1,6 @@
module github.com/shirou/gopsutil/v3

go 1.15
go 1.18
Copy link
Owner

Choose a reason for hiding this comment

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

I know the 1.15 is too old, but should it be updated in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is required for the code in this PR to actually function, so in my opinion yes. I will however defer it to another PR if you think that best.

disk/disk_aix_nocgo.go Outdated Show resolved Hide resolved
disk/disk_aix_nocgo.go Show resolved Hide resolved
host/host_aix.go Outdated Show resolved Hide resolved
@Dylan-M
Copy link
Contributor Author

Dylan-M commented May 22, 2024

Unrelated to this PR, but for my future reference, could you let me know the best way to set up an AIX emulation environment? Would QEMU be a good option?

Yes, but not using libvirt (virsh or the gui virt-manager). I scoured the internet, and played around a lot, to get this to work. It is a combination of other peoples' work, and my own knowledge. I only have it working for AIX 7.2 at this time, still working on 7.3.

# AIX 7.2 PowerPC "POWER9"
sudo qemu-system-ppc64 -M pseries,ic-mode=xics -cpu POWER9 \
  -smp 4,sockets=4,cores=2,threads=2,maxcpus=16 \
  -m 4096 \
  -name aix_7200-04-02-2027 \
  -netdev bridge,id=net0,br=virbr0 \
  -device spapr-vlan,netdev=net0,mac=52:54:00:49:53:14 \
  -device virtio-scsi,id=scsi0 \
  -drive file=/var/lib/libvirt/images/aix7.2-ppc64.qcow2,if=none,id=drive-scsi0-0-0-0,format=qcow2,cache=none \
  -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=1 \
  -drive file=/path/to/iso/aix/7.2/aix_7200-04-02-2027_1of2_072020.iso,format=raw,media=cdrom,cache=unsafe

You can edit the cpu line, I've had it working with just smp 1 and memory of -m 2048.

EDIT: This was the command I used to create my disk image:
sudo qemu-img create -f qcow2 /var/lib/libvirt/images/aix7.2-ppc64.qcow2 50G

Would you also be interested in my little test/sample program that I used to actually test this manually? I can dump it into a gist.

Move a function from nocgo to main file for disk package
@Dylan-M
Copy link
Contributor Author

Dylan-M commented May 24, 2024

Here is the test program gist

https://gist.github.com/Dylan-M/3dd22484c7fa30e6826ede5566e291eb

Copy link
Owner

@shirou shirou left a comment

Choose a reason for hiding this comment

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

Thank you for your great contribution! Unfortunately, I haven't had the time to test this PR with QEMU, but it seems unlikely there will be any issues. If there are any problems, someone will probably create an issue. Additionally, gopsutil depends on sys/unix, which specifies Go 1.18, so it seems necessary to update to Go 1.18.

@shirou shirou merged commit cb52f7a into shirou:master May 27, 2024
23 checks passed
codeboten added a commit to open-telemetry/opentelemetry-collector that referenced this pull request Jun 4, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil)
| `v3.24.4` -> `v3.24.5` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.4/v3.24.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.4/v3.24.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>shirou/gopsutil (github.com/shirou/gopsutil/v3)</summary>

###
[`v3.24.5`](https://github.com/shirou/gopsutil/releases/tag/v3.24.5)

[Compare
Source](https://github.com/shirou/gopsutil/compare/v3.24.4...v3.24.5)

<!-- Release notes generated using configuration in .github/release.yml
at v3.24.5 -->

#### What's Changed

##### cpu

- Improve AIX Support by [@&#8203;Dylan-M](https://github.com/Dylan-M)
in
[shirou/gopsutil#1651

##### process

- Add fallback for lsof output by
[@&#8203;MDrakos](https://github.com/MDrakos) in
[shirou/gopsutil#1640
- \[process]\[openbsd]: add cwd on openbsd. by
[@&#8203;shirou](https://github.com/shirou) in
[shirou/gopsutil#1649

##### Other Changes

- remove duplicate code in mktypes.sh by
[@&#8203;zhanluxianshen](https://github.com/zhanluxianshen) in
[shirou/gopsutil#1646
- add arm/arm64 category for github pr label. by
[@&#8203;zhanluxianshen](https://github.com/zhanluxianshen) in
[shirou/gopsutil#1647

#### New Contributors

- [@&#8203;zhanluxianshen](https://github.com/zhanluxianshen) made
their first contribution in
[shirou/gopsutil#1646
- [@&#8203;MDrakos](https://github.com/MDrakos) made their first
contribution in
[shirou/gopsutil#1640
- [@&#8203;Dylan-M](https://github.com/Dylan-M) made their first
contribution in
[shirou/gopsutil#1651

**Full Changelog**:
shirou/gopsutil@v3.24.4...v3.24.5

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNzcuOCIsInVwZGF0ZWRJblZlciI6IjM3LjM4OC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZWJvdCJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
codeboten pushed a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request Jun 4, 2024
…3356)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil)
| `v3.24.4` -> `v3.24.5` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.4/v3.24.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.4/v3.24.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>shirou/gopsutil (github.com/shirou/gopsutil/v3)</summary>

###
[`v3.24.5`](https://github.com/shirou/gopsutil/releases/tag/v3.24.5)

[Compare
Source](https://github.com/shirou/gopsutil/compare/v3.24.4...v3.24.5)

<!-- Release notes generated using configuration in .github/release.yml
at v3.24.5 -->

#### What's Changed

##### cpu

- Improve AIX Support by [@&#8203;Dylan-M](https://github.com/Dylan-M)
in
[shirou/gopsutil#1651

##### process

- Add fallback for lsof output by
[@&#8203;MDrakos](https://github.com/MDrakos) in
[shirou/gopsutil#1640
- \[process]\[openbsd]: add cwd on openbsd. by
[@&#8203;shirou](https://github.com/shirou) in
[shirou/gopsutil#1649

##### Other Changes

- remove duplicate code in mktypes.sh by
[@&#8203;zhanluxianshen](https://github.com/zhanluxianshen) in
[shirou/gopsutil#1646
- add arm/arm64 category for github pr label. by
[@&#8203;zhanluxianshen](https://github.com/zhanluxianshen) in
[shirou/gopsutil#1647

#### New Contributors

- [@&#8203;zhanluxianshen](https://github.com/zhanluxianshen) made
their first contribution in
[shirou/gopsutil#1646
- [@&#8203;MDrakos](https://github.com/MDrakos) made their first
contribution in
[shirou/gopsutil#1640
- [@&#8203;Dylan-M](https://github.com/Dylan-M) made their first
contribution in
[shirou/gopsutil#1651

**Full Changelog**:
shirou/gopsutil@v3.24.4...v3.24.5

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNzcuOCIsInVwZGF0ZWRJblZlciI6IjM3LjM4OC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZWJvdCJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
cparkins pushed a commit to AmadeusITGroup/opentelemetry-collector-contrib that referenced this pull request Jul 11, 2024
…en-telemetry#33356)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [github.com/shirou/gopsutil/v3](https://github.com/shirou/gopsutil)
| `v3.24.4` -> `v3.24.5` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.4/v3.24.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fshirou%2fgopsutil%2fv3/v3.24.4/v3.24.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>shirou/gopsutil (github.com/shirou/gopsutil/v3)</summary>

###
[`v3.24.5`](https://github.com/shirou/gopsutil/releases/tag/v3.24.5)

[Compare
Source](https://github.com/shirou/gopsutil/compare/v3.24.4...v3.24.5)

<!-- Release notes generated using configuration in .github/release.yml
at v3.24.5 -->

#### What's Changed

##### cpu

- Improve AIX Support by [@&open-telemetry#8203;Dylan-M](https://github.com/Dylan-M)
in
[shirou/gopsutil#1651

##### process

- Add fallback for lsof output by
[@&open-telemetry#8203;MDrakos](https://github.com/MDrakos) in
[shirou/gopsutil#1640
- \[process]\[openbsd]: add cwd on openbsd. by
[@&open-telemetry#8203;shirou](https://github.com/shirou) in
[shirou/gopsutil#1649

##### Other Changes

- remove duplicate code in mktypes.sh by
[@&open-telemetry#8203;zhanluxianshen](https://github.com/zhanluxianshen) in
[shirou/gopsutil#1646
- add arm/arm64 category for github pr label. by
[@&open-telemetry#8203;zhanluxianshen](https://github.com/zhanluxianshen) in
[shirou/gopsutil#1647

#### New Contributors

- [@&open-telemetry#8203;zhanluxianshen](https://github.com/zhanluxianshen) made
their first contribution in
[shirou/gopsutil#1646
- [@&open-telemetry#8203;MDrakos](https://github.com/MDrakos) made their first
contribution in
[shirou/gopsutil#1640
- [@&open-telemetry#8203;Dylan-M](https://github.com/Dylan-M) made their first
contribution in
[shirou/gopsutil#1651

**Full Changelog**:
shirou/gopsutil@v3.24.4...v3.24.5

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "on tuesday" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/open-telemetry/opentelemetry-collector-contrib).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNzcuOCIsInVwZGF0ZWRJblZlciI6IjM3LjM4OC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZWJvdCJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: opentelemetrybot <107717825+opentelemetrybot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants