~zulcss/nova/nova-precise-g3

« back to all changes in this revision

Viewing changes to tools/xenserver/vm_vdi_cleaner.py

  • Committer: Chuck Short
  • Date: 2013-02-25 12:48:57 UTC
  • mfrom: (94.1.5 raring-proposed)
  • Revision ID: zulcss@ubuntu.com-20130225124857-iiz7w0zqhjo1sbs3
* New upstream release for the Ubuntu Cloud Archive. 
* New usptream release. 
* debian/patches/debian/patches/fix-ubuntu-tests.patch: Refreshed.
* debian/nova-baremetal.logrotate: Fix logfile path.
* debian/control, debian/nova-spiceproxy.{install, logrotate, upstart}:
  Add spice html5 proxy support.
* debian/nova-novncproxy.upstart: Start on runlevel [2345]
* debian/rules: Call testr directly since run_tests.sh -N gives weird return
  value when tests pass.
* debian/pyddist-overrides: Add websockify.
* debian/nova-common.postinst: Removed config file conversion, since
  the option is no longer available. (LP: #1110567)
* debian/control: Add python-pyasn1 as a dependency.
* debian/control: Add python-oslo-config as a dependency.
* debian/control: Suggest sysfsutils, sg3-utils, multipath-tools for fibre
  channel support.
* debian/control: Fix typo (websocikfy -> websockify).
* SECURITY UPDATE: fix lack of authentication on block device used for
  os-volume_boot
  - debian/patches/CVE-2013-0208.patch: adjust nova/compute/api.py to
    validate we can access the volumes
  - CVE-2013-0208

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import doctest
20
20
import os
21
21
import sys
 
22
 
 
23
from oslo.config import cfg
22
24
import XenAPI
23
25
 
24
26
 
30
32
from nova import context
31
33
from nova import db
32
34
from nova import exception
33
 
from nova.openstack.common import cfg
34
35
from nova.openstack.common import timeutils
35
36
from nova.virt import virtapi
36
37
from nova.virt.xenapi import driver as xenapi_driver
40
41
               default=172800,
41
42
               help='Number of seconds zombie instances are cleaned up.'),
42
43
]
 
44
 
 
45
cli_opt = cfg.StrOpt('command',
 
46
                     default=None,
 
47
                     help='Cleaner command')
 
48
 
43
49
CONF = cfg.CONF
44
50
CONF.register_opts(cleaner_opts)
 
51
CONF.register_cli_opt(cli_opt)
 
52
CONF.import_opt('verbose', 'nova.openstack.common.log')
45
53
CONF.import_opt("resize_confirm_window", "nova.compute.manager")
46
54
 
47
55
 
50
58
 
51
59
 
52
60
def call_xenapi(xenapi, method, *args):
53
 
    """Make a call to xapi"""
 
61
    """Make a call to xapi."""
54
62
    return xenapi._session.call_xenapi(method, *args)
55
63
 
56
64
 
278
286
 
279
287
def main():
280
288
    """Main loop."""
281
 
    args = CONF(args=sys.argv,
282
 
                usage='%prog [options] [' + '|'.join(ALLOWED_COMMANDS) + ']')
283
 
    if len(args) < 2:
 
289
    args = CONF(args=sys.argv[1:], usage='%(prog)s [options] --command={' +
 
290
            '|'.join(ALLOWED_COMMANDS) + '}')
 
291
 
 
292
    command = CONF.command
 
293
    if not command or command not in ALLOWED_COMMANDS:
284
294
        CONF.print_usage()
285
295
        sys.exit(1)
286
296
 
287
 
    command = args[1]
288
 
 
289
297
    if CONF.zombie_instance_updated_at_window < CONF.resize_confirm_window:
290
298
        raise Exception("`zombie_instance_updated_at_window` has to be longer"
291
299
                " than `resize_confirm_window`.")