summaryrefslogtreecommitdiff
path: root/nova/conf/spice.py
blob: e5854946f15d82be82be94a757406f22e9c31c6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# Copyright 2016 OpenStack Foundation
# All Rights Reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

from oslo_config import cfg

spice_opt_group = cfg.OptGroup('spice',
        title="SPICE console features",
        help="""
SPICE console feature allows you to connect to a guest virtual machine.
SPICE is a replacement for fairly limited VNC protocol.

Following requirements must be met in order to use SPICE:

* Virtualization driver must be libvirt
* spice.enabled set to True
* vnc.enabled set to False
* update html5proxy_base_url
* update server_proxyclient_address
""")

CLI_OPTS = [
    cfg.HostAddressOpt('html5proxy_host',
        default='0.0.0.0',
        help="""
IP address or a hostname on which the ``nova-spicehtml5proxy`` service
listens for incoming requests.

Related options:

* This option depends on the ``html5proxy_base_url`` option.
  The ``nova-spicehtml5proxy`` service must be listening on a host that is
  accessible from the HTML5 client.
"""),
    cfg.PortOpt('html5proxy_port',
        default=6082,
        help="""
Port on which the ``nova-spicehtml5proxy`` service listens for incoming
requests.

Related options:

* This option depends on the ``html5proxy_base_url`` option.
  The ``nova-spicehtml5proxy`` service must be listening on a port that is
  accessible from the HTML5 client.
""")
]

ALL_OPTS = [
    cfg.BoolOpt('enabled',
        default=False,
        help="""
Enable SPICE related features.

Related options:

* VNC must be explicitly disabled to get access to the SPICE console. Set the
  enabled option to False in the [vnc] section to disable the VNC console.
"""),
    cfg.BoolOpt('agent_enabled',
        default=True,
        help="""
Enable the SPICE guest agent support on the instances.

The Spice agent works with the Spice protocol to offer a better guest console
experience. However, the Spice console can still be used without the Spice
Agent. With the Spice agent installed the following features are enabled:

* Copy & Paste of text and images between the guest and client machine
* Automatic adjustment of resolution when the client screen changes - e.g.
  if you make the Spice console full screen the guest resolution will adjust to
  match it rather than letterboxing.
* Better mouse integration - The mouse can be captured and released without
  needing to click inside the console or press keys to release it. The
  performance of mouse movement is also improved.
"""),
    cfg.StrOpt('image_compression',
        advanced=True,
        choices=[
            ('auto_glz', 'enable image compression mode to choose between glz '
             'and quic algorithm, based on image properties'),
            ('auto_lz', 'enable image compression mode to choose between lz '
             'and quic algorithm, based on image properties'),
            ('quic', 'enable image compression based on the SFALIC algorithm'),
            ('glz', 'enable image compression using lz with history based '
             'global dictionary'),
            ('lz', 'enable image compression with the Lempel-Ziv algorithm'),
            ('off', 'disable image compression')
        ],
        help="""
Configure the SPICE image compression (lossless).
"""),
    cfg.StrOpt('jpeg_compression',
        advanced=True,
        choices=[
            ('auto', 'enable JPEG image compression automatically'),
            ('never', 'disable JPEG image compression'),
            ('always', 'enable JPEG image compression')
        ],
        help="""
Configure the SPICE wan image compression (lossy for slow links).
"""),
    cfg.StrOpt('zlib_compression',
        advanced=True,
        choices=[
            ('auto', 'enable zlib image compression automatically'),
            ('never', 'disable zlib image compression'),
            ('always', 'enable zlib image compression')
        ],
        help="""
Configure the SPICE wan image compression (lossless for slow links).
"""),
    cfg.BoolOpt('playback_compression',
        advanced=True,
        help="""
Enable the SPICE audio stream compression (using celt).
"""),
    cfg.StrOpt('streaming_mode',
        advanced=True,
        choices=[
            ('filter', 'SPICE server adds additional filters to decide if '
             'video streaming should be activated'),
            ('all', 'any fast-refreshing window can be encoded into a video '
             'stream'),
            ('off', 'no video detection and (lossy) compression is performed')
        ],
        help="""
Configure the SPICE video stream detection and (lossy) compression.
"""),
    cfg.URIOpt('html5proxy_base_url',
        default='http://127.0.0.1:6082/spice_auto.html',
        help="""
Location of the SPICE HTML5 console proxy.

End user would use this URL to connect to the `nova-spicehtml5proxy``
service. This service will forward request to the console of an instance.

In order to use SPICE console, the service ``nova-spicehtml5proxy`` should be
running. This service is typically launched on the controller node.

Possible values:

* Must be a valid URL of the form:  ``http://host:port/spice_auto.html``
  where host is the node running ``nova-spicehtml5proxy`` and the port is
  typically 6082. Consider not using default value as it is not well defined
  for any real deployment.

Related options:

* This option depends on ``html5proxy_host`` and ``html5proxy_port`` options.
  The access URL returned by the compute node must have the host
  and port where the ``nova-spicehtml5proxy`` service is listening.
"""),
    cfg.StrOpt('server_listen',
        default='127.0.0.1',
        help="""
The  address where the SPICE server running on the instances should listen.

Typically, the ``nova-spicehtml5proxy`` proxy client runs on the controller
node and connects over the private network to this address on the compute
node(s).

Possible values:

* IP address to listen on.
"""),
    cfg.StrOpt('server_proxyclient_address',
        default='127.0.0.1',
        help="""
The address used by ``nova-spicehtml5proxy`` client to connect to instance
console.

Typically, the ``nova-spicehtml5proxy`` proxy client runs on the
controller node and connects over the private network to this address on the
compute node(s).

Possible values:

* Any valid IP address on the compute node.

Related options:

* This option depends on the ``server_listen`` option.
  The proxy client must be able to access the address specified in
  ``server_listen`` using the value of this option.
"""),
]

ALL_OPTS.extend(CLI_OPTS)


def register_opts(conf):
    conf.register_opts(ALL_OPTS, group=spice_opt_group)


def register_cli_opts(conf):
    conf.register_cli_opts(CLI_OPTS, group=spice_opt_group)


def list_opts():
    return {spice_opt_group: ALL_OPTS}