Revision 59a5de9e lib/hypervisor/hv_kvm.py

b/lib/hypervisor/hv_kvm.py
1039 1039
    hvp = instance.hvparams
1040 1040
    kernel_path = hvp[constants.HV_KERNEL_PATH]
1041 1041
    if kernel_path:
1042
      boot_disk = boot_cdrom = boot_floppy = boot_network = False
1042
      boot_cdrom = boot_floppy = boot_network = False
1043 1043
    else:
1044
      boot_disk = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_DISK
1045 1044
      boot_cdrom = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_CDROM
1046 1045
      boot_floppy = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_FLOPPY
1047 1046
      boot_network = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_NETWORK
......
1400 1399
    conf_hvp = instance.hvparams
1401 1400
    name = instance.name
1402 1401
    self._CheckDown(name)
1403
    boot_disk = conf_hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_DISK
1404 1402

  
1405 1403
    temp_files = []
1406 1404

  
......
1627 1625

  
1628 1626
    return result
1629 1627

  
1630
  def HotAddDisk(self, instance, disk, dev_path, seq):
1628
  def HotAddDisk(self, instance, disk, dev_path, _):
1631 1629
    """Hotadd new disk to the VM
1632 1630

  
1633 1631
    """
1634 1632
    if not self._InstancePidAlive(instance.name)[2]:
1635
      logging.info("Cannot hotplug. Instance %s not alive" % instance.name)
1633
      logging.info("Cannot hotplug. Instance %s not alive", instance.name)
1636 1634
      return disk.ToDict()
1637 1635

  
1638 1636
    _, v_major, v_min, _ = self._GetKVMVersion()
......
1641 1639
      command = ("drive_add dummy file=%s,if=none,id=drive%d,format=raw" %
1642 1640
                 (dev_path, idx))
1643 1641

  
1644
      logging.info("%s" % command)
1642
      logging.info("Run cmd %s", command)
1645 1643
      output = self._CallMonitorCommand(instance.name, command)
1646 1644

  
1647 1645
      command = ("device_add virtio-blk-pci,bus=pci.0,addr=%s,"
1648 1646
                 "drive=drive%d,id=virtio-blk-pci.%d"
1649 1647
                 % (hex(disk.pci), idx, idx))
1650
      logging.info("%s" % command)
1648
      logging.info("Run cmd %s", command)
1651 1649
      output = self._CallMonitorCommand(instance.name, command)
1652 1650
      for line in output.stdout.splitlines():
1653
        logging.info("%s" % line)
1651
        logging.info("%s", line)
1654 1652

  
1655 1653
      (kvm_cmd, kvm_nics,
1656 1654
       hvparams, block_devices) = self._LoadKVMRuntime(instance)
......
1660 1658

  
1661 1659
    return disk.ToDict()
1662 1660

  
1663
  def HotDelDisk(self, instance, disk, seq):
1661
  def HotDelDisk(self, instance, disk, _):
1664 1662
    """Hotdel disk to the VM
1665 1663

  
1666 1664
    """
1667 1665
    if not self._InstancePidAlive(instance.name)[2]:
1668
      logging.info("Cannot hotplug. Instance %s not alive" % instance.name)
1666
      logging.info("Cannot hotplug. Instance %s not alive", instance.name)
1669 1667
      return disk.ToDict()
1670 1668

  
1671 1669
    _, v_major, v_min, _ = self._GetKVMVersion()
......
1673 1671
      idx = disk.idx
1674 1672

  
1675 1673
      command = "device_del virtio-blk-pci.%d" % idx
1676
      logging.info("%s" % command)
1674
      logging.info("Run cmd %s", command)
1677 1675
      output = self._CallMonitorCommand(instance.name, command)
1678 1676
      for line in output.stdout.splitlines():
1679
        logging.info("%s" % line)
1677
        logging.info("%s", line)
1680 1678

  
1681 1679
      command = "drive_del drive%d" % idx
1682
      logging.info("%s" % command)
1680
      logging.info("Run cmd %s", command)
1683 1681
      #output = self._CallMonitorCommand(instance.name, command)
1684 1682
      #for line in output.stdout.splitlines():
1685 1683
      #  logging.info("%s" % line)
......
1702 1700

  
1703 1701
    """
1704 1702
    if not self._InstancePidAlive(instance.name)[2]:
1705
      logging.info("Cannot hotplug. Instance %s not alive" % instance.name)
1703
      logging.info("Cannot hotplug. Instance %s not alive", instance.name)
1706 1704
      return nic.ToDict()
1707 1705

  
1708 1706
    _, v_major, v_min, _ = self._GetKVMVersion()
......
1717 1715

  
1718 1716
      command = ("netdev_add tap,id=netdev%d,fd=netdev%d"
1719 1717
                 % (idx, idx))
1720
      logging.info("%s" % command)
1718
      logging.info("Run cmd %s", command)
1721 1719
      output = self._CallMonitorCommand(instance.name, command)
1722 1720
      for line in output.stdout.splitlines():
1723
        logging.info("%s" % line)
1721
        logging.info("%s", line)
1724 1722

  
1725 1723
      command = ("device_add virtio-net-pci,bus=pci.0,addr=%s,mac=%s,"
1726 1724
                 "netdev=netdev%d,id=virtio-net-pci.%d"
1727 1725
                 % (hex(nic.pci), mac, idx, idx))
1728
      logging.info("%s" % command)
1726
      logging.info("Run cmd %s", command)
1729 1727
      output = self._CallMonitorCommand(instance.name, command)
1730 1728
      for line in output.stdout.splitlines():
1731
        logging.info("%s" % line)
1729
        logging.info("%s", line)
1732 1730

  
1733 1731
      self._ConfigureNIC(instance, seq, nic, tap)
1734 1732

  
......
1740 1738

  
1741 1739
    return nic.ToDict()
1742 1740

  
1743
  def HotDelNic(self, instance, nic, seq):
1741
  def HotDelNic(self, instance, nic, _):
1744 1742
    """Hotadd new nic to the VM
1745 1743

  
1746 1744
    """
1747 1745
    if not self._InstancePidAlive(instance.name)[2]:
1748
      logging.info("Cannot hotplug. Instance %s not alive" % instance.name)
1746
      logging.info("Cannot hotplug. Instance %s not alive", instance.name)
1749 1747
      return nic.ToDict()
1750 1748

  
1751 1749
    _, v_major, v_min, _ = self._GetKVMVersion()
1752 1750
    if (v_major, v_min) >= (1, 0) and nic.pci:
1753
      mac = nic.mac
1754 1751
      idx = nic.idx
1755 1752

  
1756 1753
      command = "device_del virtio-net-pci.%d" % idx
1757
      logging.info("%s" % command)
1754
      logging.info("Run cmd %s", command)
1758 1755
      output = self._CallMonitorCommand(instance.name, command)
1759 1756
      for line in output.stdout.splitlines():
1760
        logging.info("%s" % line)
1757
        logging.info("%s", line)
1761 1758

  
1762 1759
      command = "netdev_del netdev%d" % idx
1763
      logging.info("%s" % command)
1760
      logging.info("Run cmd %s", command)
1764 1761
      output = self._CallMonitorCommand(instance.name, command)
1765 1762
      for line in output.stdout.splitlines():
1766
        logging.info("%s" % line)
1763
        logging.info("%s", line)
1767 1764

  
1768 1765
      (kvm_cmd, kvm_nics,
1769 1766
       hvparams, block_devices) = self._LoadKVMRuntime(instance)

Also available in: Unified diff