Commit cc208ed0 authored by Guido Trotter's avatar Guido Trotter
Browse files

Merge branch 'master' into branch-2.1

* master:
  Fix adjustement of candidates in cluster modify
  Add a new node list field
  Fix HTTP server library handling of credentials
  Fix a typo in backend.InstanceReboot docstring
  Fix handling of 'vcpus' in instance list
  Fix checking for valid OS in instance create
  Show disk size in instance info

    docstring update, mixed version kept
    OS validity checking, branch-2.1 version kept, since the new rpc
    included all the error checking
parents b2a6ccd4 75e914fb
......@@ -963,9 +963,10 @@ def InstanceReboot(instance, reboot_type):
instance OS, do not recreate the VM
- L{constants.INSTANCE_REBOOT_HARD}: tear down and
restart the VM (at the hypervisor level)
- the other reboot type (L{constants.INSTANCE_REBOOT_HARD})
is not accepted here, since that mode is handled
- the other reboot type (L{constants.INSTANCE_REBOOT_FULL}) is
not accepted here, since that mode is handled differently, in
cmdlib, and translates into full stop and start of the
instance (instead of a call_instance_reboot RPC)
@rtype: None
......@@ -701,6 +701,8 @@ def FormatError(err):
" job submissions until old jobs are archived\n")
elif isinstance(err, errors.TypeEnforcementError):
obuf.write("Parameter Error: %s" % msg)
elif isinstance(err, errors.ParameterError):
obuf.write("Failure: unknown/wrong parameter name '%s'" % msg)
elif isinstance(err, errors.GenericError):
obuf.write("Unhandled Ganeti error: %s" % msg)
elif isinstance(err, luxi.NoMasterError):
......@@ -1606,14 +1606,11 @@ class LUSetClusterParams(LogicalUnit):
if self.op.candidate_pool_size is not None:
self.cluster.candidate_pool_size = self.op.candidate_pool_size
# we need to update the pool size here, otherwise the save will fail
# we want to update nodes after the cluster so that if any errors
# happen, we have recorded and saved the cluster info
if self.op.candidate_pool_size is not None:
def _RedistributeAncillaryFiles(lu, additional_nodes=None):
"""Distribute additional files which are part of the cluster configuration.
......@@ -1976,6 +1973,7 @@ class LUQueryNodes(NoHooksLU):
def ExpandNames(self):
......@@ -2104,6 +2102,17 @@ class LUQueryNodes(NoHooksLU):
val = node.drained
elif self._FIELDS_DYNAMIC.Matches(field):
val = live_data[].get(field, None)
elif field == "role":
if == master_node:
val = "M"
elif node.master_candidate:
val = "C"
elif node.drained:
val = "D"
elif node.offline:
val = "O"
val = "R"
raise errors.ParameterError(field)
......@@ -3513,6 +3522,8 @@ class LUQueryInstances(NoHooksLU):
val = live_data[].get("memory", "?")
val = "-"
elif field == "vcpus":
val = i_be[constants.BE_VCPUS]
elif field == "disk_template":
val = instance.disk_template
elif field == "ip":
......@@ -3624,9 +3635,10 @@ class LUQueryInstances(NoHooksLU):
assert False, "Unhandled NIC parameter"
assert False, "Unhandled variable parameter"
assert False, ("Declared but unhandled variable parameter '%s'" %
raise errors.ParameterError(field)
assert False, "Declared but unhandled parameter '%s'" % field
......@@ -5799,6 +5811,7 @@ class LUQueryInstanceData(NoHooksLU):
"sstatus": dev_sstatus,
"children": dev_children,
"mode": dev.mode,
"size": dev.size,
return data
......@@ -101,10 +101,14 @@ class HttpServerRequestAuthentication(object):
realm = self.GetAuthRealm(req)
# Authentication required?
if realm is None:
# Authentication not required, and no credentials given?
if realm is None and http.HTTP_AUTHORIZATION not in req.request_headers:
if realm is None: # in case we don't require auth but someone
# passed the crendentials anyway
realm = "Unspecified"
# Check "Authorization" header
if self._CheckAuthorization(req):
# User successfully authenticated
......@@ -423,6 +423,38 @@
<simpara>whether the node is offline or not</simpara>
A condensed version of the node flags; this field will
output a one-character field, with the following
possible values:
<simpara><emphasis>M</emphasis> for the master
<simpara><emphasis>C</emphasis> for a master
<simpara><emphasis>R</emphasis> for a regular
<simpara><emphasis>D</emphasis> for a drained
<simpara><emphasis>O</emphasis> for an offline
......@@ -220,6 +220,7 @@ def ListInstances(opts, args):
"hvparams": "Hypervisor_parameters",
"be/memory": "Configured_memory",
"be/vcpus": "VCPUs",
"vcpus": "VCPUs",
"be/auto_balance": "Auto_balance",
"disk.count": "Disks", "disk.sizes": "Disk_sizes",
"nic.count": "NICs", "nic.ips": "NIC_IPs",
......@@ -1040,7 +1041,11 @@ def _FormatBlockDevInfo(idx, top_level, dev, static):
txt = "disk %d" % idx
txt = "child %d" % idx
d1 = ["- %s: %s" % (txt, dev["dev_type"])]
if isinstance(dev["size"], int):
nice_size = utils.FormatUnit(dev["size"], "h")
nice_size = dev["size"]
d1 = ["- %s: %s, size %s" % (txt, dev["dev_type"], nice_size)]
data = []
if top_level:
data.append(("access mode", dev["mode"]))
......@@ -56,6 +56,7 @@ _LIST_HEADERS = {
"master_candidate": "MasterC",
"master": "IsMaster",
"offline": "Offline", "drained": "Drained",
"role": "Role",
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment