diff --git a/lib/hypervisor/hv_fake.py b/lib/hypervisor/hv_fake.py index fdfbdef21ccc4939c7ea428bab21f0047e354464..e688099b8eb0334b30007a67ab087ce5bece26be 100644 --- a/lib/hypervisor/hv_fake.py +++ b/lib/hypervisor/hv_fake.py @@ -122,7 +122,9 @@ class FakeHypervisor(hv_base.BaseHypervisor): try: fh = file(file_name, "w") try: - fh.write("0\n%d\n%d\n" % (instance.memory, instance.vcpus)) + fh.write("0\n%d\n%d\n" % + (instance.beparams[constants.BE_MEMORY], + instance.beparams[constants.BE_VCPUS])) finally: fh.close() except IOError, err: diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index b3b8940fdacd1c040580e942a7e86d19525e6745..dd78e00322576a613d31ef0d782408723a6e6658 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -176,8 +176,8 @@ class KVMHypervisor(hv_base.BaseHypervisor): kvm = constants.KVM_PATH kvm_cmd = [kvm] - kvm_cmd.extend(['-m', instance.memory]) - kvm_cmd.extend(['-smp', instance.vcpus]) + kvm_cmd.extend(['-m', instance.beparams[constants.BE_MEMORY]]) + kvm_cmd.extend(['-smp', instance.beparams[constants.BE_VCPUS]]) kvm_cmd.extend(['-pidfile', pidfile]) # used just by the vnc server, if enabled kvm_cmd.extend(['-name', instance.name]) @@ -372,4 +372,3 @@ class KVMHypervisor(hv_base.BaseHypervisor): """ if not os.path.exists(constants.KVM_PATH): return "The kvm binary ('%s') does not exist." % constants.KVM_PATH - diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py index cea3fa8ce09f1c73f17d161896d73bc4ba0406ad..0ee8911fd30b424fef5ab273a931a6163e44b768 100644 --- a/lib/hypervisor/hv_xen.py +++ b/lib/hypervisor/hv_xen.py @@ -353,8 +353,8 @@ class XenPvmHypervisor(XenHypervisor): config.write("ramdisk = '%s'\n" % initrd_path) # rest of the settings - config.write("memory = %d\n" % instance.memory) - config.write("vcpus = %d\n" % instance.vcpus) + config.write("memory = %d\n" % instance.beparams[constants.BE_MEMORY]) + config.write("vcpus = %d\n" % instance.beparams[constants.BE_VCPUS]) config.write("name = '%s'\n" % instance.name) vif_data = [] @@ -467,8 +467,8 @@ class XenHvmHypervisor(XenHypervisor): config.write("# this is autogenerated by Ganeti, please do not edit\n#\n") config.write("kernel = '/usr/lib/xen/boot/hvmloader'\n") config.write("builder = 'hvm'\n") - config.write("memory = %d\n" % instance.memory) - config.write("vcpus = %d\n" % instance.vcpus) + config.write("memory = %d\n" % instance.beparams[constants.BE_MEMORY]) + config.write("vcpus = %d\n" % instance.beparams[constants.BE_VCPUS]) config.write("name = '%s'\n" % instance.name) if instance.hvparams[constants.HV_PAE]: config.write("pae = 1\n")