virsh address does not read hostname when adding machine

Bug #1842454 reported by Mark Darmadi
36
This bug affects 8 people
Affects Status Importance Assigned to Milestone
MAAS
Invalid
Medium
Unassigned

Bug Description

Hi there,

I am attempting to add a machine on MaaS using the Virsh (Virtual system) power type.

Ever since this (https://bugs.launchpad.net/maas/+bug/1815136?comments=all) changed, I have been looking for solutions to register my VMWare instances (VSphere)

whenever I do not assign a hostname to VMWare, running this command:
virsh -c esx://root@<vmware_IP> list --all
will output:

error: failed to connect to the hypervisor
error: internal error: curl_easy_perform() returned an error: SSL peer certificate or SSH remote key was not OK (51) : SSL: certificate subject name (<vmware_IP>) does not match target host name '<vmware_IP>'

I then generated SSL certs and exchanged them between the MAAS servers and VMWare until I am able to list the VMs using:
virsh -c esx://root@<vmware_hostname> list --all

Now the problem is that when I try to add them through MAAS, using: esx://root@<vmware_hostname>,
MAAS does not read the hostname and translate them properly, this is the error message:

[info] BMC could not save extracted IP address '<vmware_hostname>': 'failed to detect a valid IP address from '<vmware_hostname>''

Since this has just been recently, there's not alot of resources for this fix. I hope someone here can help!

Revision history for this message
Blake Rouse (blake-rouse) wrote :

Seems that the MAAS controller cannot resolve the vmware_hostname. Be sure to confirm that the region controller of MAAS can resolve that hostname.

Changed in maas:
status: New → Incomplete
Revision history for this message
Mark Darmadi (darmadoo) wrote :

I have 3 rack controllers and all of them can resolve that hostname when I try to ping the hostname. I see that it translates the hostname to its IP.

For that to work, I added the domain and the A record on MAAS.

Alberto Donato (ack)
Changed in maas:
status: Incomplete → Triaged
importance: Undecided → Medium
Revision history for this message
José Pekkarinen (koalinux) wrote :
Download full text (4.0 KiB)

I reproduced this very same on a virsh environment, no vmware, I set
my libvirt node by name, instead of ip and I'm using fce to reproduce
it, the output from fce looks like:

2019-10-14-08:15:50 root ERROR Command failed: machines create hostname=juju-1 power_type=virsh architecture=amd64/generic mac_addresses=52:54:00:fe:8c:8b power_parameters_power_address=qemu+ssh://<email address hidden>/system zone=default power_parameters_power_id=juju-1
2019-10-14-08:15:50 root ERROR b"failed to detect a valid IP address from 'myserver.mydomain.com'"
Traceback (most recent call last):
  File "/usr/local/bin/fce", line 11, in <module>
    load_entry_point('foundationcloudengine', 'console_scripts', 'fce')()
  File "/home/ubuntu/fce/foundation/foundationcloudengine/foundationcloudengine/main.py", line 141, in entry_point
    sys.exit(main(sys.argv[1:]))
  File "/home/ubuntu/fce/foundation/foundationcloudengine/foundationcloudengine/main.py", line 132, in main
    opts.func(opts)
  File "/home/ubuntu/fce/foundation/foundationcloudengine/foundationcloudengine/build.py", line 73, in build_main
    args.steps)
  File "/home/ubuntu/fce/foundation/foundationcloudengine/foundationcloudengine/build.py", line 47, in build_and_validate_if_needed
    layer.build_outer(only_steps)
  File "/home/ubuntu/fce/foundation/foundationcloudengine/foundationcloudengine/layers/baselayer.py", line 119, in build_outer
    self.build(only_steps=only_steps)
  File "/home/ubuntu/fce/foundation/foundationcloudengine/foundationcloudengine/layers/maaslayer.py", line 2676, in build
    super(MaasLayer, self).run_steps(only_steps)
  File "/home/ubuntu/fce/foundation/foundationcloudengine/foundationcloudengine/layers/steppedbaselayer.py", line 51, in run_steps
    step.build()
  File "/home/ubuntu/fce/foundation/foundationcloudengine/foundationcloudengine/layers/maaslayer.py", line 2069, in build
    enlisting_nodes = self._enlist_maas_nodes()
  File "/home/ubuntu/fce/foundation/foundationcloudengine/foundationcloudengine/layers/maaslayer.py", line 2130, in _enlist_maas_nodes
    self._maas_profile, hostname, node)
  File "/home/ubuntu/fce/foundation/foundationcloudengine/foundationcloudengine/maas_cli.py", line 88, in add_virsh_node
    return _add_node(maas_profile, hostname, node, power_id_param)
  File "/home/ubuntu/fce/foundation/foundationcloudengine/foundationcloudengine/maas_cli.py", line 66, in _add_node
    return cmd(maas_profile, command)
  File "/home/ubuntu/fce/foundation/foundationcloudengine/foundationcloudengine/maas_cli.py", line 117, in cmd
    raise error
  File "/home/ubuntu/fce/foundation/foundationcloudengine/foundationcloudengine/maas_cli.py", line 112, in cmd
    output = raw_cmd(maas_profile, split_command)
  File "/home/ubuntu/fce/foundation/foundationcloudengine/foundationcloudengine/maas_cli.py", line 106, in raw_cmd
    return subprocess.check_output(maas_cmd)
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['maas', 'admin', 'machines', 'create', 'hostname=juju-1', 'power_type=v...

Read more...

Revision history for this message
José Pekkarinen (koalinux) wrote :

Executing right after the maas cli the following command, gives full output
so name is resolved and operated properly, it's maas enforcing the ip address
while it should alow a name:

$ virsh -c qemu+ssh://<email address hidden>/system list --all
 Id Name State
----------------------------------------------------
 2 mirror running
...

José.

Revision history for this message
Mr. Jester (mrjester) wrote :

Still an issue on MAAS Snap 2.8.1-8567-g.c4825ca06

Trying to add a LXD host by using DNS name and it returns "failed to detect a valid IP address from '<hostname>'. When I enter it by either v4 or v6 IP, it works fine. NOTE: I have to put the v6 address in brackets.

Revision history for this message
Jeremy Lundy (jlundy-litmus) wrote :

So I'm on MAAS 2.9.1 (9153-g.66318f531)
I'm running a POC to see if MAAS meets my organization's needs on an isolated ESXi and I can't add a ESXi based machine because I can't disable SSL checking and I can't resolve my SSL secured hostname.

Revision history for this message
Mark Darmadi (darmadoo) wrote :

I am now running MaaS 2.7.3 and I am still seeing this issue where maas cannot resolve the hostname when adding a machine. It might be a bug in code because I am able resolve to the hostname perfectly fine.

Revision history for this message
Jerzy Husakowski (jhusakowski) wrote :

Virsh VM hosts currently can be added to MAAS only via their IP address. Using virsh to connect to ESXi is not the recommended way of reaching ESXi hosts, MAAS nowadays allows configuring VMware power management directly, which should be used instead - see e.g. https://maas.io/docs/power-management-reference#heading--vmware

Changed in maas:
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.