Coder Social home page Coder Social logo

kurokobo / virtualbmc-for-vsphere Goto Github PK

View Code? Open in Web Editor NEW
44.0 44.0 16.0 112 KB

VirtualBMC for vSphere, a virtual BMC for controlling virtual machines using IPMI commands for the VMware vSphere environment.

License: Apache License 2.0

Python 99.63% Dockerfile 0.37%

virtualbmc-for-vsphere's People

Contributors

bpengu1n avatar codekow avatar dstremkouski avatar kurokobo avatar olemmela avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

virtualbmc-for-vsphere's Issues

Unable to start VM

Environment:
Python 3.6.8
vsbmc 0.3.0

I followed the documentation in installing the package, and start vbmcd.

vsbmc add labmachine --port 6230 —address 192.168.10.101 --viserver 10.0.10.101 --viserver-username [email protected] --viserver-password password

When execute command #vsbmc start labmachine, it throws error

Error running vBMC with configuration {} [Error 99] Cannot assign requested address.

Error re: vbmc_runner pickling on starting vbmcd

Environment:
macOS 11.2.3
Python 3.9.0 (installed via homebrew)
Latest pip/pypi index+packages

I followed the documentation in installing the package, and on attempting to start vbmcd, I get the following error:

~ » vbmcd --foreground
2021-03-21 00:17:20,414.414 65337 ERROR VirtualBMC [-] Can't pickle local object 'VirtualBMCManager._sync_vbmc_states.<locals>.vbmc_runner'

vbmcd does not show in process list or netstat, and vbmc reports an error attempting to connect, so definitely not running. Only other steps I took prior were vbmc add .... and vbmc start ....

Noticed that if I start from scratch, vbmcd does start initially, but dies after adding my server and calling vbmc start ....

config contents (w/ creds + IPs redacted):

[VirtualBMC]
username = [BMC-USERNAME]
password = [BMC-PASSWORD]
address = ::
port = 6230
fakemac = 02:00:00:4e:70:e5
vm_name = fangorn-vesxi01
viserver = [IP]
viserver_username = [VC-USERNAME]
viserver_password = [VC-PASSWORD]
active = True

vBMC not listening on port 623

After adding a few VMs via vbmc, the IP address for them is not listening on port 623. vbmcd is running fine.

vbmc nodes were created using

vbmc add maas-node-1 --address 10.20.0.1 --port 623 --viserver 192.168.100.160 --viserver-username root --viserver-password <password-removed>
vbmc add maas-node-2 --address 10.20.0.2 --port 623 --viserver 192.168.100.160 --viserver-username root --viserver-password <password-removed>

The IPs being used are present and pingable on the host running vbmcd. The nodes seem to be listed but port 623 is not listening on 10.20.0.1 or 10.20.0.2

root@ub-focal-vm:~# vbmc list --fakemac
+-------------+--------+-----------+------+-------------------+
| VM name     | Status | Address   | Port | Fake MAC          |
+-------------+--------+-----------+------+-------------------+
| maas-node-1 | down   | 10.20.0.1 |  623 | 02:00:00:b3:ea:35 |
| maas-node-2 | down   | 10.20.0.2 |  623 | 02:00:00:2b:63:a7 |
+-------------+--------+-----------+------+-------------------+
root@ub-focal-vm:~# telnet 10.20.0.1 623
Trying 10.20.0.1...
telnet: Unable to connect to remote host: Connection refused

Naming collision with `vbmc`

While this isn't a show stopper for my uses. I think it could impact or even confuse other people.

Is there a reason you named the cli vbmc which conflicts with another project?

What if you named it vcbmc and vcbmcd (vCenter BMC) ... or vsbmc (yes, those names may be awful, but you get the idea)? Thoughts?

Add `--vm-uuid` option to `add` command

Add --vm-uuid option to add command to specify uuid for specific vm without modifying config file directly. This makes #14 handy.

  • Add new option
  • Describe how to gather uuid for vm
  • Update README.md

vbmc start to fail if vcenter have more than 100 virtual machines

Error message in the logs is:

2021-09-15 10:51:05,497.497 27 DEBUG VirtualBMC [-] Get power state called for vm compute1v
2021-09-15 10:51:05,654.654 27 ERROR VirtualBMC [-] Error getting the power state of vm compute1v. Error: No VN with matching name compute1v was found
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/vbmc4vsphere/utils.py", line 99, in get_viserver_vm
    raise Exception
Exception

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/vbmc4vsphere/vbmc.py", line 247, in get_power_state
    vm = utils.get_viserver_vm(conn, self.vm_name)
  File "/usr/local/lib/python3.9/site-packages/vbmc4vsphere/utils.py", line 104, in get_viserver_vm
    raise exception.VMNotFound(vm=vm)
vbmc4vsphere.exception.VMNotFound: No VN with matching name compute1v was found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/vbmc4vsphere/vbmc.py", line 466, in handle_raw_request
    return self.get_chassis_status(session)
  File "/usr/local/lib/python3.9/site-packages/pyghmi/ipmi/bmc.py", line 91, in get_chassis_status
    powerstate = self.get_power_state()
  File "/usr/local/lib/python3.9/site-packages/vbmc4vsphere/vbmc.py", line 256, in get_power_state
    raise exception.VirtualBMCError(message=msg)
vbmc4vsphere.exception.VirtualBMCError: Error getting the power state of vm compute1v. Error: No VN with matching name compute1v was found

Issue is in RetrievePropertiesEx function which returns max 100 items in one call.
https://github.com/kurokobo/virtualbmc-for-vsphere/blob/master/vbmc4vsphere/utils.py#L94

Symbol $ in --viserver-password

Environment:
CentOS Stream 8
Python 3.6.8
vsbmc 0.3.0

I followed the documentation in installing the package, and start vbmcd.
Then I added a new virtual BMC to control VM called control-1-os-loc. The password for the viserver contains the characters '$'

vsbmc add control-1-os-loc --port 6230 --viserver 10.169.173.3 --viserver-username [email protected] --viserver-password Pa$$word1

As a result, a different password is stored in the settings configuration file, and virtual machine management does not work.

[root@vbmc ~]# cat .vsbmc/control-1-os-loc/config
[VirtualBMC]
vm_name = control-1-os-loc
username = admin
password = password
port = 6230
address = ::
fakemac = 02:00:00:0f:e1:50
viserver = 10.169.173.3
viserver_username = [email protected]
viserver_password = Pa3248word1
active = False

[Errno -5] Name has no usable address

I know there is docker version of vbmc4vsphere. My use case is slightly different.
I have my custom docker instance running where I have installed vbmc4vsphere=0.3.0.

I also pre-create the vbmc config file wrt a VM (For some reason, I cannot use vsbmc add cmd)
When I run vsbmcd, I see an error as below:

0203833ef9ed:/app# mkdir -p ~/.vsbmc/Test-01/

0203833ef9ed:/app# vi ~/.vsbmc/Test-01/config

0203833ef9ed:/app# vsbmcd --foreground

2024-06-05 04:17:17,666.666 66 INFO VirtualBMC [-] Started vBMC instance for vm Test-01

2024-06-05 04:17:17,668.668 66 INFO VirtualBMC [-] Started vBMC server on port 50891

2024-06-05 04:17:17,672.672 67 ERROR VirtualBMC [-] Shutdown vBMC for vm Test-01, cause [Errno -5] Name has no usable address

Traceback (most recent call last):

File "/usr/local/lib/python3.11/site-packages/vbmc4vsphere/manager.py", line 151, in vbmc_runner

vbmc.listen(timeout=CONF["ipmi"]["session_timeout"])

File "/usr/local/lib/python3.11/site-packages/pyghmi/ipmi/bmc.py", line 192, in listen

ipmisession.Session.wait_for_rsp(timeout)

File "/usr/local/lib/python3.11/site-packages/pyghmi/ipmi/private/session.py", line 1184, in wait_for_rsp

if _poller(timeout=timeout):

   ^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/local/lib/python3.11/site-packages/pyghmi/ipmi/private/session.py", line 249, in _poller

_io_wait(timeout)

File "/usr/local/lib/python3.11/site-packages/pyghmi/ipmi/private/session.py", line 179, in _io_wait

intsock.sendto(b'\x01', (myself, iosockets[0].getsockname()[1]))

socket.gaierror: [Errno -5] Name has no usable address

I also verified that same steps works outside the docker

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.