dalgibbard / citrix_xenserver_patcher

Auto / Manual Patching tool for Citrix XenServer Boxes
Do What The F*ck You Want To Public License
142 stars 45 forks source link

Host detection failes, if "hostname -f" returns no hostname #10

Closed speedbur closed 10 years ago

speedbur commented 10 years ago

The hostname on my machine seems to be invalid and the patcher could not get the hosts uuid, because the call to hostname -f failes.

"get_host_uuid_cmd = str(xecli) + str(" host-list hostname=`hostname -f` params=uuid --minimal")
[root@myhost patcher]# ./patcher.py
hostname: Unknown host
Error: Failed to obtain HOSTUUID from XE CLI

[root@myhost patcher]# hostname -f
hostname: Unknown host

Could not reboot the server machine right now, so i don't know if setting the hostname with "xe host-set-hostname-live uuid= host-name=example" will resolve that issue. I'll inform you later about this.

dalgibbard commented 10 years ago

Ah yes, this is a valid issue since the last commit- I utilised hostname -f to identify the hostuuid of the current host (to differentiate against other nodes within a pool). This is naturally going to be an issue for anyone who has boxes without an FQDN. I'll have a rethink and see if it can be worked around.

rob0r commented 10 years ago

Also seeing this same problem. Have reverted to the 1.1 release for now and it's working fine :) https://github.com/dalgibbard/citrix_xenserver_patcher/blob/70026d504c8b5bfd5b164aae067a27d901312bef/patcher.py

dalgibbard commented 10 years ago

I've made an amendment here to switch it for checking against "address=" and using "hostname -i" (IP address) instead; this should fix it - could you possibly verify?

The commit is in 89036ae9ae2fb6a00c8a0bc7807cd8690c9e0c33

speedbur commented 10 years ago

Unfortunately hostname -i also returns hostname: Unknown host :(

speedbur commented 10 years ago

Perhaps this could help you. if I call xe host-list using the name-label I get a valid result for my machine.

[root@mybox ~]# xe host-list name-label=`hostname` params=uuid --minimal
<guid of mybox>
dalgibbard commented 10 years ago

Yeah that's definitely valid. I do have conerns over what this returns when the node is a Master of a pool... but that's a seperate story. For the time being, i've added IP evaluation on the node, and am using that against "address" until I find a fix for #6 :-)

speedbur commented 10 years ago

Your evaluation from b92a06fa66d4adbae669425c029c1efb9d55a31a works on my machine :)

dalgibbard commented 10 years ago

I'll set this as closed me thinks :)