Commit 246fa7d4 authored by Klaus Aehlig's avatar Klaus Aehlig
Browse files

Merge branch 'stable-2.11' into master

* stable-2.11
  (no changes)

* stable-2.10
  KVM: use running HVPs to calc blockdev options
  KVM: reserve a PCI slot for the SCSI controller
  Check for LVM-based verification results only when enabled
  Fix "existing" typos
  Fix output of gnt-instance info after migration
  Verify configuration version number before parsing

Conflicts:
	lib/config.py: manually apply 2dc0acb9


	    to the version on master
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parents 5f2d6a8f c1cbe302
......@@ -1339,7 +1339,7 @@ def SetInstanceParams(opts, args):
for action, _, __ in nics:
if action == constants.DDM_MODIFY and opts.hotplug and not opts.force:
usertext = ("You are about to hot-modify a NIC. This will be done"
" by removing the exisiting and then adding a new one."
" by removing the existing NIC and then adding a new one."
" Network connection might be lost. Continue?")
if not AskUser(usertext):
return 1
......
......@@ -3491,10 +3491,13 @@ class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
if nimg.vm_capable:
self._UpdateVerifyNodeLVM(node_i, nresult, vg_name, nimg)
self._VerifyNodeDrbd(node_i, nresult, self.all_inst_info, drbd_helper,
all_drbd_map)
if constants.DT_DRBD8 in cluster.enabled_disk_templates:
self._VerifyNodeDrbd(node_i, nresult, self.all_inst_info, drbd_helper,
all_drbd_map)
self._UpdateNodeVolumes(node_i, nresult, nimg, vg_name)
if (constants.DT_PLAIN in cluster.enabled_disk_templates) or \
(constants.DT_DRBD8 in cluster.enabled_disk_templates):
self._UpdateNodeVolumes(node_i, nresult, nimg, vg_name)
self._UpdateNodeInstances(node_i, nresult, nimg)
self._UpdateNodeInfo(node_i, nresult, nimg, vg_name)
self._UpdateNodeOS(node_i, nresult, nimg)
......
......@@ -159,13 +159,17 @@ class LUInstanceQueryData(NoHooksLU):
# we change the snode then (otherwise we use the one passed in)
if dev.logical_id[0] == instance.primary_node:
snode_uuid = dev.logical_id[1]
snode_minor = dev.logical_id[4]
pnode_minor = dev.logical_id[3]
else:
snode_uuid = dev.logical_id[0]
snode_minor = dev.logical_id[3]
pnode_minor = dev.logical_id[4]
drbd_info = {
"primary_node": node_uuid2name_fn(instance.primary_node),
"primary_minor": dev.logical_id[3],
"primary_minor": pnode_minor,
"secondary_node": node_uuid2name_fn(snode_uuid),
"secondary_minor": dev.logical_id[4],
"secondary_minor": snode_minor,
"port": dev.logical_id[2],
"secret": dev.logical_id[5],
}
......
......@@ -118,7 +118,7 @@ _UPGRADE_CONFIG_JID = "jid-cfg-upgrade"
def _ValidateConfig(data):
"""Verifies that a configuration objects looks valid.
"""Verifies that a configuration dict looks valid.
This only verifies the version of the configuration.
......@@ -126,8 +126,9 @@ def _ValidateConfig(data):
we expect
"""
if data.version != constants.CONFIG_VERSION:
raise errors.ConfigVersionMismatch(constants.CONFIG_VERSION, data.version)
if data['version'] != constants.CONFIG_VERSION:
raise errors.ConfigVersionMismatch(constants.CONFIG_VERSION,
data['version'])
class TemporaryReservationManager:
......@@ -2515,19 +2516,16 @@ class ConfigWriter(object):
# If online, call WConfd.
if self._offline:
raw_data = utils.ReadFile(self._cfg_file)
try:
dict_data = serializer.Load(raw_data)
data_dict = serializer.Load(raw_data)
# Make sure the configuration has the right version
_ValidateConfig(data_dict)
data = objects.ConfigData.FromDict(data_dict)
except errors.ConfigVersionMismatch:
raise
except Exception, err:
raise errors.ConfigurationError(err)
self._cfg_id = utils.GetFileID(path=self._cfg_file)
try:
data = objects.ConfigData.FromDict(dict_data)
except Exception, err:
raise errors.ConfigurationError(err)
# Make sure the configuration has the right version
_ValidateConfig(data)
self._cfg_id = utils.GetFileID(path=self._cfg_file)
if (not hasattr(data, "cluster") or
not hasattr(data.cluster, "rsahostkeypub")):
......
......@@ -885,12 +885,14 @@ class KVMHypervisor(hv_base.BaseHypervisor):
data.append(info)
return data
def _GenerateKVMBlockDevicesOptions(self, instance, kvm_disks,
def _GenerateKVMBlockDevicesOptions(self, instance, up_hvp, kvm_disks,
kvmhelp, devlist):
"""Generate KVM options regarding instance's block devices.
@type instance: L{objects.Instance}
@param instance: the instance object
@type up_hvp: dict
@param up_hvp: the instance's runtime hypervisor parameters
@type kvm_disks: list of tuples
@param kvm_disks: list of tuples [(disk, link_name, uri)..]
@type kvmhelp: string
......@@ -901,12 +903,11 @@ class KVMHypervisor(hv_base.BaseHypervisor):
@return: list of command line options eventually used by kvm executable
"""
hvp = instance.hvparams
kernel_path = hvp[constants.HV_KERNEL_PATH]
kernel_path = up_hvp[constants.HV_KERNEL_PATH]
if kernel_path:
boot_disk = False
else:
boot_disk = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_DISK
boot_disk = up_hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_DISK
# whether this is an older KVM version that uses the boot=on flag
# on devices
......@@ -914,7 +915,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
dev_opts = []
device_driver = None
disk_type = hvp[constants.HV_DISK_TYPE]
disk_type = up_hvp[constants.HV_DISK_TYPE]
if disk_type == constants.HT_DISK_PARAVIRTUAL:
if_val = ",if=%s" % self._VIRTIO
try:
......@@ -927,7 +928,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
else:
if_val = ",if=%s" % disk_type
# Cache mode
disk_cache = hvp[constants.HV_DISK_CACHE]
disk_cache = up_hvp[constants.HV_DISK_CACHE]
if instance.disk_template in constants.DTS_EXT_MIRROR:
if disk_cache != "none":
# TODO: make this a hard error, instead of a silent overwrite
......@@ -1088,6 +1089,10 @@ class KVMHypervisor(hv_base.BaseHypervisor):
_ = _GetFreeSlot(pci_reservations, reserve=True)
kvm_cmd.extend(["-soundhw", soundhw])
if hvp[constants.HV_DISK_TYPE] == constants.HT_DISK_SCSI:
# The SCSI controller requires another PCI slot.
_ = _GetFreeSlot(pci_reservations, reserve=True)
# Add id to ballon and place to the first available slot (3 or 4)
addr = _GetFreeSlot(pci_reservations, reserve=True)
pci_info = ",bus=pci.0,addr=%s" % hex(addr)
......@@ -1648,6 +1653,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
self._ConfigureNIC(instance, nic_seq, nic, taps[nic_seq])
bdev_opts = self._GenerateKVMBlockDevicesOptions(instance,
up_hvp,
kvm_disks,
kvmhelp,
devlist)
......
......@@ -443,7 +443,7 @@ def _CheckFileStoragePathExistance(path):
"""
if not os.path.isdir(path):
raise errors.FileStoragePathError("Path '%s' is not existing or not a"
raise errors.FileStoragePathError("Path '%s' does not exist or is not a"
" directory." % path)
if not os.access(path, os.W_OK):
raise errors.FileStoragePathError("Path '%s' is not writable" % path)
......@@ -467,6 +467,6 @@ def CheckFileStoragePath(
except errors.FileStoragePathError as e:
return str(e)
if not os.path.isdir(path):
return "Path '%s' is not exisiting or not a directory." % path
return "Path '%s' is not existing or not a directory." % path
if not os.access(path, os.W_OK):
return "Path '%s' is not writable" % path
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