diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 600707329f07219fab6f1d3ce4b2f731f0226c48..10d68fb7306fbff7ae9f69df3992c9690dbc573f 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -7864,12 +7864,10 @@ class LUInstanceCreate(LogicalUnit): raise errors.OpPrereqError("Invalid file driver name '%s'" % self.op.file_driver, errors.ECODE_INVAL) - if (self.op.disk_template == constants.DT_FILE and - not constants.ENABLE_FILE_STORAGE): - raise errors.OpPrereqError("File storage disabled") - elif (self.op.disk_template == constants.DT_SHARED_FILE and - not constants.ENABLE_SHARED_FILE_STORAGE): - raise errors.OpPrereqError("Shared file storage disabled") + if self.op.disk_template == constants.DT_FILE: + opcodes.RequireFileStorage() + elif self.op.disk_template == constants.DT_SHARED_FILE: + opcodes.RequireSharedFileStorage() ### Node/iallocator related checks _CheckIAllocatorOrNode(self, "iallocator", "pnode") diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index 33dca73a6f30f82d3057d7959234c396923dfc73..7e947a68642caa0b0639d6fed97f24f5063aafef 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -506,6 +506,12 @@ class KVMHypervisor(hv_base.BaseHypervisor): """Generate KVM information to start an instance. """ + kvm_version = self._GetKVMVersion() + if kvm_version: + _, v_major, v_min, _ = kvm_version + else: + raise errors.HypervisorError("Unable to get KVM version") + pidfile = self._InstancePidFile(instance.name) kvm = constants.KVM_PATH kvm_cmd = [kvm] @@ -555,16 +561,12 @@ class KVMHypervisor(hv_base.BaseHypervisor): raise errors.HypervisorError("Instance has read-only disks which" " are not supported by KVM") # TODO: handle FD_LOOP and FD_BLKTAP (?) + boot_val = "" if boot_disk: kvm_cmd.extend(['-boot', 'c']) - if disk_type != constants.HT_DISK_IDE: - boot_val = ',boot=on' - else: - boot_val = '' - # We only boot from the first disk boot_disk = False - else: - boot_val = '' + if (v_major, v_min) < (0, 14) and disk_type != constants.HT_DISK_IDE: + boot_val = ",boot=on" drive_val = 'file=%s,format=raw%s%s%s' % (dev_path, if_val, boot_val, cache_val) @@ -882,7 +884,7 @@ class KVMHypervisor(hv_base.BaseHypervisor): raise else: uid.Unlock() - utils.WriteFile(self._InstanceUidFile(name), data=str(uid)) + utils.WriteFile(self._InstanceUidFile(name), data=uid.AsStr()) else: self._RunKVMCmd(name, kvm_cmd, tapfds)