<s> """<STR_LIT>""" <EOL> import eventlet <EOL> eventlet . monkey_patch ( ) <EOL> import os <EOL> import sys <EOL> from oslo_config import cfg <EOL> POSSIBLE_TOPDIR = os . path . normpath ( os . path . join ( os . path . abspath ( sys . argv [ <NUM_LIT:0> ] ) , <EOL> os . pardir , <EOL> os . pardir , <EOL> os . pardir ) ) <EOL> if os . path . exists ( os . path . join ( POSSIBLE_TOPDIR , '<STR_LIT>' , '<STR_LIT>' ) ) : <EOL> sys . path . insert ( <NUM_LIT:0> , POSSIBLE_TOPDIR ) <EOL> from nova import config <EOL> from nova import utils <EOL> from nova . virt . xenapi . client import session <EOL> from nova . virt . xenapi import vm_utils <EOL> destroy_opts = [ <EOL> cfg . BoolOpt ( '<STR_LIT>' , <EOL> default = False , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' ) , <EOL> cfg . BoolOpt ( '<STR_LIT>' , <EOL> default = False , <EOL> help = '<STR_LIT>' ) <EOL> ] <EOL> CONF = cfg . CONF <EOL> CONF . register_cli_opts ( destroy_opts ) <EOL> CONF . import_opt ( '<STR_LIT>' , '<STR_LIT>' , <EOL> group = '<STR_LIT>' ) <EOL> CONF . import_opt ( '<STR_LIT>' , '<STR_LIT>' , <EOL> group = '<STR_LIT>' ) <EOL> CONF . import_opt ( '<STR_LIT>' , '<STR_LIT>' , <EOL> group = '<STR_LIT>' ) <EOL> def main ( ) : <EOL> config . parse_args ( sys . argv ) <EOL> utils . monkey_patch ( ) <EOL> _session = session . XenAPISession ( CONF . xenserver . connection_url , <EOL> CONF . xenserver . connection_username , <EOL> CONF . xenserver . connection_password ) <EOL> sr_ref = vm_utils . safe_find_sr ( _session ) <EOL> destroyed = vm_utils . destroy_cached_images ( <EOL> _session , sr_ref , all_cached = CONF . all_cached , <EOL> dry_run = CONF . dry_run ) <EOL> if '<STR_LIT>' in sys . argv : <EOL> print '<STR_LIT:\n>' . join ( destroyed ) <EOL> print "<STR_LIT>" % len ( destroyed ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
