<s> """<STR_LIT>""" <EOL> from . . manager import DisksFormatConvertor <EOL> from . . manager import VolumeManager <EOL> from . . validators . disks import NodeDisksValidator <EOL> from nailgun . api . v1 . handlers . base import BaseHandler <EOL> from nailgun . api . v1 . handlers . base import content <EOL> from nailgun import objects <EOL> class NodeDisksHandler ( BaseHandler ) : <EOL> validator = NodeDisksValidator <EOL> @ content <EOL> def GET ( self , node_id ) : <EOL> """<STR_LIT>""" <EOL> from . . objects . volumes import VolumeObject <EOL> node = self . get_object_or_404 ( objects . Node , node_id ) <EOL> node_volumes = VolumeObject . get_volumes ( node ) <EOL> return DisksFormatConvertor . format_disks_to_simple ( node_volumes ) <EOL> @ content <EOL> def PUT ( self , node_id ) : <EOL> """<STR_LIT>""" <EOL> from . . objects . volumes import VolumeObject <EOL> node = self . get_object_or_404 ( objects . Node , node_id ) <EOL> data = self . checked_data ( <EOL> self . validator . validate , <EOL> node = node <EOL> ) <EOL> if node . cluster : <EOL> objects . Cluster . add_pending_changes ( <EOL> node . cluster , <EOL> '<STR_LIT>' , <EOL> node_id = node . id <EOL> ) <EOL> volumes_data = DisksFormatConvertor . format_disks_to_full ( node , data ) <EOL> VolumeObject . set_volumes ( node , volumes_data ) <EOL> return DisksFormatConvertor . format_disks_to_simple ( <EOL> VolumeObject . get_volumes ( node ) ) <EOL> class NodeDefaultsDisksHandler ( BaseHandler ) : <EOL> @ content <EOL> def GET ( self , node_id ) : <EOL> """<STR_LIT>""" <EOL> node = self . get_object_or_404 ( objects . Node , node_id ) <EOL> volumes = DisksFormatConvertor . format_disks_to_simple ( <EOL> VolumeManager ( node ) . gen_volumes_info ( ) ) <EOL> return volumes <EOL> class NodeVolumesInformationHandler ( BaseHandler ) : <EOL> @ content <EOL> def GET ( self , node_id ) : <EOL> """<STR_LIT>""" <EOL> node = self . get_object_or_404 ( objects . Node , node_id ) <EOL> if node . cluster is None : <EOL> raise self . http ( <NUM_LIT> , '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> volumes_info = DisksFormatConvertor . get_volumes_info ( node ) <EOL> return volumes_info </s>
