Revision afa9bb2e

b/lib/hypervisor/hv_kvm.py
325 325
    greeting = self._Recv()
326 326
    if not greeting[self._FIRST_MESSAGE_KEY]:
327 327
      self._connected = False
328
      raise errors.HypervisorError("kvm: qmp communication error (wrong"
328
      raise errors.HypervisorError("kvm: QMP communication error (wrong"
329 329
                                   " server greeting")
330 330

  
331 331
    # Let's put the monitor in command mode using the qmp_capabilities
......
488 488
    constants.HV_VNC_BIND_ADDRESS:
489 489
      (False, lambda x: (netutils.IP4Address.IsValid(x) or
490 490
                         utils.IsNormAbsPath(x)),
491
       "the VNC bind address must be either a valid IP address or an absolute"
491
       "The VNC bind address must be either a valid IP address or an absolute"
492 492
       " pathname", None, None),
493 493
    constants.HV_VNC_TLS: hv_base.NO_CHECK,
494 494
    constants.HV_VNC_X509: hv_base.OPT_DIR_CHECK,
......
498 498
    constants.HV_KVM_SPICE_IP_VERSION:
499 499
      (False, lambda x: (x == constants.IFACE_NO_IP_VERSION_SPECIFIED or
500 500
                         x in constants.VALID_IP_VERSIONS),
501
       "the SPICE IP version should be 4 or 6",
501
       "The SPICE IP version should be 4 or 6",
502 502
       None, None),
503 503
    constants.HV_KVM_SPICE_PASSWORD_FILE: hv_base.OPT_FILE_CHECK,
504 504
    constants.HV_KVM_SPICE_LOSSLESS_IMG_COMPR:
......
881 881

  
882 882
    result = utils.RunCmd([pathutils.KVM_IFUP, tap], env=env)
883 883
    if result.failed:
884
      raise errors.HypervisorError("Failed to configure interface %s: %s."
885
                                   " Network configuration script output: %s" %
884
      raise errors.HypervisorError("Failed to configure interface %s: %s;"
885
                                   " network configuration script output: %s" %
886 886
                                   (tap, result.fail_reason, result.output))
887 887

  
888 888
  @staticmethod
......
1249 1249
          else:
1250 1250
            vnc_arg = "%s:%d" % (vnc_bind_address, display)
1251 1251
        else:
1252
          logging.error("Network port is not a valid VNC display (%d < %d)."
1253
                        " Not starting VNC", instance.network_port,
1254
                        constants.VNC_BASE_PORT)
1252
          logging.error("Network port is not a valid VNC display (%d < %d),"
1253
                        " not starting VNC",
1254
                        instance.network_port, constants.VNC_BASE_PORT)
1255 1255
          vnc_arg = "none"
1256 1256

  
1257 1257
        # Only allow tls and other option when not binding to a file, for now.
......
1287 1287
        # have that kind of IP addresses, throw an exception
1288 1288
        if spice_ip_version != constants.IFACE_NO_IP_VERSION_SPECIFIED:
1289 1289
          if not addresses[spice_ip_version]:
1290
            raise errors.HypervisorError("spice: unable to get an IPv%s address"
1290
            raise errors.HypervisorError("SPICE: Unable to get an IPv%s address"
1291 1291
                                         " for %s" % (spice_ip_version,
1292 1292
                                                      spice_bind))
1293 1293

  
......
1304 1304
        elif addresses[constants.IP6_VERSION]:
1305 1305
          spice_ip_version = constants.IP6_VERSION
1306 1306
        else:
1307
          raise errors.HypervisorError("spice: unable to get an IP address"
1307
          raise errors.HypervisorError("SPICE: Unable to get an IP address"
1308 1308
                                       " for %s" % (spice_bind))
1309 1309

  
1310 1310
        spice_address = addresses[spice_ip_version][0]
......
1359 1359
        # Enable the spice agent communication channel between the host and the
1360 1360
        # agent.
1361 1361
        kvm_cmd.extend(["-device", "virtio-serial-pci"])
1362
        kvm_cmd.extend(["-device", "virtserialport,chardev=spicechannel0,"
1363
                                                   "name=com.redhat.spice.0"])
1362
        kvm_cmd.extend([
1363
          "-device",
1364
          "virtserialport,chardev=spicechannel0,name=com.redhat.spice.0",
1365
          ])
1364 1366
        kvm_cmd.extend(["-chardev", "spicevmc,id=spicechannel0,name=vdagent"])
1365 1367

  
1366 1368
      logging.info("KVM: SPICE will listen on port %s", instance.network_port)
......
1705 1707
              utils.ShellQuote(self._InstanceMonitor(instance_name))))
1706 1708
    result = utils.RunCmd(socat)
1707 1709
    if result.failed:
1708
      msg = ("Failed to send command '%s' to instance %s."
1709
             " output: %s, error: %s, fail_reason: %s" %
1710
             (command, instance_name,
1711
              result.stdout, result.stderr, result.fail_reason))
1710
      msg = ("Failed to send command '%s' to instance '%s', reason '%s',"
1711
             " output: %s" %
1712
             (command, instance_name, result.fail_reason, result.output))
1712 1713
      raise errors.HypervisorError(msg)
1713 1714

  
1714 1715
    return result
......
2125 2126
        # IP of that family
2126 2127
        if (netutils.IP4Address.IsValid(spice_bind) and
2127 2128
            spice_ip_version != constants.IP4_VERSION):
2128
          raise errors.HypervisorError("spice: got an IPv4 address (%s), but"
2129
          raise errors.HypervisorError("SPICE: Got an IPv4 address (%s), but"
2129 2130
                                       " the specified IP version is %s" %
2130 2131
                                       (spice_bind, spice_ip_version))
2131 2132

  
2132 2133
        if (netutils.IP6Address.IsValid(spice_bind) and
2133 2134
            spice_ip_version != constants.IP6_VERSION):
2134
          raise errors.HypervisorError("spice: got an IPv6 address (%s), but"
2135
          raise errors.HypervisorError("SPICE: Got an IPv6 address (%s), but"
2135 2136
                                       " the specified IP version is %s" %
2136 2137
                                       (spice_bind, spice_ip_version))
2137 2138
    else:
......
2139 2140
      # error if any of them is set without it.
2140 2141
      for param in _SPICE_ADDITIONAL_PARAMS:
2141 2142
        if hvparams[param]:
2142
          raise errors.HypervisorError("spice: %s requires %s to be set" %
2143
          raise errors.HypervisorError("SPICE: %s requires %s to be set" %
2143 2144
                                       (param, constants.HV_KVM_SPICE_BIND))
2144 2145

  
2145 2146
  @classmethod
......
2168 2169
    if spice_bind:
2169 2170
      # only one of VNC and SPICE can be used currently.
2170 2171
      if hvparams[constants.HV_VNC_BIND_ADDRESS]:
2171
        raise errors.HypervisorError("both SPICE and VNC are configured, but"
2172
        raise errors.HypervisorError("Both SPICE and VNC are configured, but"
2172 2173
                                     " only one of them can be used at a"
2173
                                     " given time.")
2174
                                     " given time")
2174 2175

  
2175 2176
      # check that KVM supports SPICE
2176 2177
      kvmhelp = cls._GetKVMOutput(kvm_path, cls._KVMOPT_HELP)
2177 2178
      if not cls._SPICE_RE.search(kvmhelp):
2178
        raise errors.HypervisorError("spice is configured, but it is not"
2179
                                     " supported according to kvm --help")
2179
        raise errors.HypervisorError("SPICE is configured, but it is not"
2180
                                     " supported according to 'kvm --help'")
2180 2181

  
2181 2182
      # if spice_bind is not an IP address, it must be a valid interface
2182
      bound_to_addr = (netutils.IP4Address.IsValid(spice_bind)
2183
                       or netutils.IP6Address.IsValid(spice_bind))
2183
      bound_to_addr = (netutils.IP4Address.IsValid(spice_bind) or
2184
                       netutils.IP6Address.IsValid(spice_bind))
2184 2185
      if not bound_to_addr and not netutils.IsValidInterface(spice_bind):
2185
        raise errors.HypervisorError("spice: the %s parameter must be either"
2186
        raise errors.HypervisorError("SPICE: The %s parameter must be either"
2186 2187
                                     " a valid IP address or interface name" %
2187 2188
                                     constants.HV_KVM_SPICE_BIND)
2188 2189

  

Also available in: Unified diff