master_ip = cfg.GetMasterIP()
master_node = cfg.GetMasterNode()
except errors.ConfigurationError, err:
- _Fail("Cluster configuration incomplete", exc=True)
+ _Fail("Cluster configuration incomplete: %s", err, exc=True)
return master_netdev, master_ip, master_node
"""
# GetMasterInfo will raise an exception if not able to return data
- master_netdev, master_ip, _ = GetMasterInfo()[1]
+ master_netdev, master_ip, _ = GetMasterInfo()
payload = []
if utils.TcpPing(master_ip, constants.DEFAULT_NODED_PORT):
# need to decide in which case we fail the RPC for this
# GetMasterInfo will raise an exception if not able to return data
- master_netdev, master_ip, _ = GetMasterInfo()[1]
+ master_netdev, master_ip, _ = GetMasterInfo()
result = utils.RunCmd(["ip", "address", "del", "%s/32" % master_ip,
"dev", master_netdev])
for hname in hypervisor_list:
iinfo = hypervisor.GetHypervisor(hname).GetAllInstancesInfo()
if iinfo:
- for name, inst_id, memory, vcpus, state, times in iinfo:
+ for name, _, memory, vcpus, state, times in iinfo:
value = {
'memory': memory,
'vcpus': vcpus,
"pv_count": int(valarr[2]),
}
except ValueError, err:
- logging.exception("Fail to parse vgs output")
+ logging.exception("Fail to parse vgs output: %s", err)
else:
logging.error("vgs output has the wrong number of fields (expected"
" three): %s", str(valarr))
"""Remove the block device symlinks belonging to the given instance.
"""
- for idx, disk in enumerate(disks):
+ for idx, _ in enumerate(disks):
link_name = _GetBlockDevSymlinkPath(instance_name, idx)
if os.path.islink(link_name):
try:
clist.append(crdev)
try:
- device = bdev.Create(disk.dev_type, disk.physical_id, clist, size)
+ device = bdev.Create(disk.dev_type, disk.physical_id, clist, disk.size)
except errors.BlockDeviceError, err:
_Fail("Can't create block device: %s", err)
children.append(cdev)
if as_primary or disk.AssembleOnSecondary():
- r_dev = bdev.Assemble(disk.dev_type, disk.physical_id, children)
+ r_dev = bdev.Assemble(disk.dev_type, disk.physical_id, children, disk.size)
r_dev.SetSyncSpeed(constants.SYNC_SPEED)
result = r_dev
if as_primary or disk.OpenOnSecondary():
for chdisk in disk.children:
children.append(_RecursiveFindBD(chdisk))
- return bdev.FindDevice(disk.dev_type, disk.physical_id, children)
+ return bdev.FindDevice(disk.dev_type, disk.physical_id, children, disk.size)
def BlockdevFind(disk):
try:
f_names = utils.ListVisibleFiles(dir_name)
except EnvironmentError, err:
- logging.exception("Can't list the OS directory %s", dir_name)
+ logging.exception("Can't list the OS directory %s: %s", dir_name, err)
break
for name in f_names:
os_path = os.path.sep.join([dir_name, name])
result['NIC_%d_FRONTEND_TYPE' % idx] = \
instance.hvparams[constants.HV_NIC_TYPE]
+ for source, kind in [(instance.beparams, "BE"), (instance.hvparams, "HV")]:
+ for key, value in source.items():
+ result["INSTANCE_%s_%s" % (kind, key)] = str(value)
+
return result
def BlockdevGrow(disk, amount):
# standalone, even though this should not happen with the
# new staged way of changing disk configs
try:
- rd.ReAttachNet(multimaster)
+ rd.AttachNet(multimaster)
except errors.BlockDeviceError, err:
_Fail("Can't change network configuration: %s", err)
if all_connected:
min_resync = 100
alldone = True
- failure = False
for rd in bdevs:
stats = rd.GetProcStatus()
if not (stats.is_connected or stats.is_in_resync):
hyper = hypervisor.GetHypervisor(hypervisor_type)
try:
pid = os.fork()
- except OSError, err:
+ except OSError:
# if we can't fork, we'll pretend that we're in the child process
pid = 0
if pid > 0:
dir_name = "%s/%s" % (self._BASE_DIR, subdir)
try:
dir_contents = utils.ListVisibleFiles(dir_name)
- except OSError, err:
+ except OSError:
# FIXME: must log output in case of failures
return rr
try:
utils.WriteFile(fpath, data=fdata)
except EnvironmentError, err:
- logging.exception("Can't update bdev cache for %s", dev_path)
+ logging.exception("Can't update bdev cache for %s: %s", dev_path, err)
@classmethod
def RemoveCache(cls, dev_path):
try:
utils.RemoveFile(fpath)
except EnvironmentError, err:
- logging.exception("Can't update bdev cache for %s", dev_path)
+ logging.exception("Can't update bdev cache for %s: %s", dev_path, err)