X-Git-Url: https://code.grnet.gr/git/ganeti-local/blobdiff_plain/07813a9efd0baac14437ebcc9841c66e3131a265..c57f169e84ca5fbcc25af1f4db2014742e6dd45e:/lib/backend.py diff --git a/lib/backend.py b/lib/backend.py index 831f36c..b08c937 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -660,9 +660,14 @@ def GetAllInstancesInfo(hypervisor_list): 'state': state, 'time': times, } - if name in output and output[name] != value: - raise errors.HypervisorError("Instance %s running duplicate" - " with different parameters" % name) + if name in output: + # we only check static parameters, like memory and vcpus, + # and not state and time which can change between the + # invocations of the different hypervisors + for key in 'memory', 'vcpus': + if value[key] != output[name][key]: + raise errors.HypervisorError("Instance %s is running twice" + " with different parameters" % name) output[name] = value return output @@ -1119,7 +1124,7 @@ def BlockdevCreate(disk, size, owner, on_primary, info): 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: return False, "Can't create block device: %s" % str(err) @@ -1229,7 +1234,7 @@ def _RecursiveAssembleBD(disk, owner, as_primary): 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(): @@ -1399,7 +1404,7 @@ def _RecursiveFindBD(disk): 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): @@ -1685,6 +1690,10 @@ def OSEnvironment(instance, debug=0): 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): @@ -2383,7 +2392,7 @@ def DrbdAttachNet(nodes_ip, disks, instance_name, multimaster): # 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: return (False, "Can't change network configuration: %s" % str(err)) if all_connected: