On 12/13/2012 05:25 PM, Iustin Pop wrote:
On Thu, Dec 13, 2012 at 05:04:11PM +0200, Constantinos Venetsanopoulos wrote:
Hello team,

while testing the current master branch I stumbled upon this,
which seems like a bug:

when creating a new instance with --no-name-check --no-ip-check
I get the following error:

Failure: command execution error:
'LUInstanceCreate' object has no attribute 'hostname1'

I see that in CheckPrereq you do:

# NIC buildup
self.nics = _ComputeNics(self.op, cluster, self.hostname1.ip, self.cfg,
                          self.proc.GetECId())

without checking if self.hostname exists.
I also see that in CheckArguments you do:

# instance name verification
if self.op.name_check:
    self.hostname1 = _CheckHostnameSane(self, self.op.instance_name)
    self.op.instance_name = self.hostname1.name
    # used in CheckPrereq for ip ping check
    self.check_ip = self.hostname1.ip
else:
    self.check_ip = None

which in the case of --no-name-check probably doesn't
set self.hostname1

I haven't seen this part of the code in depth, but I suppose we need
to check self.check_ip before running _ComputeNics in CheckPrereq


Is the above valid? Do I understand correctly or have I missed
something?
This is correct indeed, thanks for the investigation! Will you send a
patch?

Since hostname1.ip is assigned to self.check_ip in CheckArguments, and
in _ComputeNics the op.name_check is already verified, the only thing
that is needed is, I think, making the call be _ComputeNic(…, …,
self.check_ip, …).

thanks!
iustin

Yes, I'm sending a patch right now.

Constantinos

Reply via email to