cmdlib.py: don't use GetHypervisor

In cmdlib we must only use the hypervisor class, and never instantiate
it. As such we have to call GetHypervisorClass instead, to avoid
getting an instance of it.

This fixes Issue 316, because __init__ is not called from masterd
anymore, and thus can't fail on EnsureDirs.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Fix TypeError when unsetting OS parameters

When all OS parameters should be unset (“gnt-os modify -H -xen-pvm
foo”), a TypeError was raised. This fixes issue 311.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Update NEWS for 2.6.2

This is in preparation for a 2.6.2 release.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Stop verifying opcode results in dry_run mode

Commit 1ce03fb1 (“Add ht-based result checks to opcodes”) introduced
infrastructure for checking opcode results, and subsequent commits
improved the list of opcodes which do declare a result, however this
was not tested for dry-run mode operation.

Furthermore, there's no authoritative list of which opcode/LUs support
dry_run mode at all; currently, this is based/restricted on the list
of CLI options, so… for now we disable the result verification if the
opcode has been executed in dry_run mode.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Fix gnt-instance(8) w.r.t. growable disk templates

This fixes Issue 257.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
Small corrections in man pages

The only semantic change is the fix of the spelling of the option
--ipolicy-disk-templates.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Change hbal handling of !auto_balance instances

Note: I'll add tests for this on the master branch, but not here.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
confd: reduce noise during normal config reload

During a normal configuration update, done via write to temp file and
rename, this is what confd logs (slightly edited for clarity):

2012-12-14 01:05:53: ganeti-confd INFO Loaded new config, serial 21866
2012-12-14 01:06:18: ganeti-confd INFO File lost, trying to re-establish notifier
2012-12-14 01:06:18: ganeti-confd INFO Loaded new config, serial 21867
2012-12-14 01:07:09: ganeti-confd INFO File lost, trying to re-establish notifier
2012-12-14 01:07:09: ganeti-confd INFO Loaded new config, serial 21868

Since this happens always, we should demote the "File lost" messages
to debug level, to keep the logs more clear.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Bernardo Dal Seno <bdalseno@google.com>
Fix job completion with big job queues

Accidentally stumbled upon this while testing unrelated code on a
machine with ~3K active jobs - the bash completion unittest was
hanging.

Upon investigation, it turns out that bash's ${var//pattern/repl/} is
probably quadratic in the size of input (or worse, even):

  $ touch job-{1..500}
  $ time ( a=$(echo job-*); echo ${a//job-/}| wc -c; )
  1892

  real    0m0.597s
  user    0m0.590s

  $ touch job-{1..1000}
  $ time ( a=$(echo job-*); echo ${a//job-/}| wc -c; )
  3893

  real    0m4.654s
  user    0m4.580s

We can easily fix this if we change to array-based substitution (once
per element):

  $ time ( a=($(echo job-*)); echo ${a[*]/job-/} |wc -c; )
  3893

  real    0m0.028s
  user    0m0.010s

  $ touch job-{1..10000}
  $ time ( a=($(echo job-*)); echo ${a[*]/job-/} |wc -c; )
  48894

  real    0m0.233s
  user    0m0.220s

This means that exactly when the master node is busy processing many
jobs, we could accidentally start consuming lots of CPU in the bash
completion, which is not good.

Note: the code might have problems with filenames containing spaces (I
didn't reset the IFS, etc.), but the original code had the same issue,
I think.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
Final update of NEWS file for 2.6.2 and version bump

I'm already setting this to a release date of tomorrow, since QA on
the 2.6 branch has been clean.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
QA: Do not pass "--bridge" to "gnt-cluster init"

Commit ec0652a (June 2009) removed the option.

This is a cherry-pick of master commit
784537390cd5b1c4f5f8fb9401a62eb23acce39b

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
QA: Support master-netdev and default NIC parameters

Requested in issue 337.

The parameter “bridge” was not documented and is therefore silently
replaced with “master-netdev”. A note is added to “qa-sample.json”
describing how comments work.

This is a cherry-pick of master commit
3601d488464d85531a5a42c263ae2c021a8023c1

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Remove fixed FIXME

This was fixed in stable-2.6, commit 053c356

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
Add utility to format dictionary as key=value strings

This will be used in QA to format network interface parameters.

This is a cherry-pick of master commit eac9b7b8

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
QA: Use instance name for rename test

Reported in issue 341. In some setups the instance live in a different
netblock from the cluster. Therefore a the configuration-global “rename”
name shouldn't be used for them. Instead another instance name is used.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Merge remote-tracking branch 'origin/stable-2.6' into sockets-2.6