예제 #1
0
    def migration_vm_checks(self, vm_name, dest_node, live):
       """
       Implements a series of compatiblity checks required for successful
       migration.
       """
       (err_list, warn_list) = VNode.migration_vm_checks(self, vm_name,
                                                         dest_node, live)
       
       if self.is_up():
            vm = self.get_dom(vm_name)
       else:
            vm = DBHelper().find_by_name(VM,vm_name)
       if vm == None :
          err_list.append(("VM", "VM %s not found."% vm_name))
          return (err_list, warn_list)


       # mem assumed to be in MB (same unit)
       vm_memory = 0
       if vm.is_running():
          vm_memory = vm["memory"]

       if dest_node.is_up():
           node_free_mem =  self.guess_free_mem(dest_node)
           if int(vm_memory) >  node_free_mem:
              err_list.append(("Memory","Insufficient memory on destination node. " \
                              "VM memory %s, free memory on destination node %s " % 
                              (vm["memory"], node_free_mem)))

       # TBD : compare CPUs. This needs to encode compatibility list.
       #       check AMD/INTEL
       #       X86/X32

       # 32 bit vs 64 bit kernel

       # critical files available or not.
       vm_conf = vm.get_config()
       if vm_conf is not None and dest_node.is_up():
          bootloader = vm_conf["bootloader"]
          if bootloader and bootloader.strip() is not "":
             if not dest_node.node_proxy.file_exists(bootloader.strip()):
                err_list.append(("Bootloader","Bootloader %s for %s vm not found on destination node." % (bootloader.strip(), vm.name)))
          kernel = vm_conf["kernel"]
          if kernel and kernel.strip() is not "":
             if not dest_node.node_proxy.file_exists(kernel.strip()):
                err_list.append(("Kernel","Kernel %s for %s vm not found on destination node." % (kernel.strip(), vm.name)))
          ramdisk = vm_conf["ramdisk"]
          if ramdisk and ramdisk.strip() is not "":
             if not dest_node.node_proxy.file_exists(ramdisk.strip()):
                err_list.append(("Ramdisk", "Ramdisk %s for %s vm not found on destination node." % (ramdisk.strip(), vm.name)))
     
       # hvm availablity
       if vm_conf and vm_conf.is_hvm() \
          and dest_node.get_platform_info().get("xen_caps","").find("hvm")==-1:
          err_list.append(("HVM","VM %s requires hvm capabilities which are not found on destination node." % (vm.name)))


       # TBD : PAE kernel check

       return (err_list, warn_list)
예제 #2
0
    def migration_vm_checks(self, vm_name, dest_node, live):
        """
       Implements a series of compatiblity checks required for successful
       migration.
       """
        (err_list,
         warn_list) = VNode.migration_vm_checks(self, vm_name, dest_node, live)

        if self.is_up():
            vm = self.get_dom(vm_name)
        else:
            vm = DBHelper().find_by_name(VM, vm_name)
        if vm == None:
            err_list.append(("VM", "VM %s not found." % vm_name))
            return (err_list, warn_list)

        # mem assumed to be in MB (same unit)
        vm_memory = 0
        if vm.is_running():
            vm_memory = vm["memory"]

        if dest_node.is_up():
            node_free_mem = self.guess_free_mem(dest_node)
            if int(vm_memory) > node_free_mem:
                err_list.append(("Memory","Insufficient memory on destination node. " \
                                "VM memory %s, free memory on destination node %s " %
                                (vm["memory"], node_free_mem)))

        # TBD : compare CPUs. This needs to encode compatibility list.
        #       check AMD/INTEL
        #       X86/X32

        # 32 bit vs 64 bit kernel

        # critical files available or not.
        vm_conf = vm.get_config()
        if vm_conf is not None and dest_node.is_up():
            bootloader = vm_conf["bootloader"]
            if bootloader and bootloader.strip() is not "":
                if not dest_node.node_proxy.file_exists(bootloader.strip()):
                    err_list.append((
                        "Bootloader",
                        "Bootloader %s for %s vm not found on destination node."
                        % (bootloader.strip(), vm.name)))
            kernel = vm_conf["kernel"]
            if kernel and kernel.strip() is not "":
                if not dest_node.node_proxy.file_exists(kernel.strip()):
                    err_list.append(
                        ("Kernel",
                         "Kernel %s for %s vm not found on destination node." %
                         (kernel.strip(), vm.name)))
            ramdisk = vm_conf["ramdisk"]
            if ramdisk and ramdisk.strip() is not "":
                if not dest_node.node_proxy.file_exists(ramdisk.strip()):
                    err_list.append((
                        "Ramdisk",
                        "Ramdisk %s for %s vm not found on destination node." %
                        (ramdisk.strip(), vm.name)))

        # hvm availablity
        if vm_conf and vm_conf.is_hvm() \
           and dest_node.get_platform_info().get("xen_caps","").find("hvm")==-1:
            err_list.append((
                "HVM",
                "VM %s requires hvm capabilities which are not found on destination node."
                % (vm.name)))

        # TBD : PAE kernel check

        return (err_list, warn_list)