|
Lines 195-200
Link Here
|
| 195 |
umch.simpleHandler.__init__( self, command_description ) |
195 |
umch.simpleHandler.__init__( self, command_description ) |
| 196 |
self.uvmm = uvmmd.Client( auto_connect = False ) |
196 |
self.uvmm = uvmmd.Client( auto_connect = False ) |
| 197 |
self.device_wizard = DeviceWizard( 'uvmm/device/create' ) |
197 |
self.device_wizard = DeviceWizard( 'uvmm/device/create' ) |
|
|
198 |
self.domain_wizard = InstanceWizard( 'uvmm/domain/create' ) |
| 198 |
|
199 |
|
| 199 |
@staticmethod |
200 |
@staticmethod |
| 200 |
def _getattr( object, attr, default = '' ): |
201 |
def _getattr( object, attr, default = '' ): |
|
Lines 639-645
Link Here
|
| 639 |
self.finished( object.id(), res ) |
640 |
self.finished( object.id(), res ) |
| 640 |
|
641 |
|
| 641 |
def uvmm_domain_state( self, object ): |
642 |
def uvmm_domain_state( self, object ): |
| 642 |
ud.debug( ud.ADMIN, ud.INFO, 'Domain State' ) |
643 |
ud.debug( ud.ADMIN, ud.INFO, 'Domain State' ) |
| 643 |
res = umcp.Response( object ) |
644 |
res = umcp.Response( object ) |
| 644 |
|
645 |
|
| 645 |
ud.debug( ud.ADMIN, ud.INFO, 'Domain State: change to %s' % object.options[ 'state' ] ) |
646 |
ud.debug( ud.ADMIN, ud.INFO, 'Domain State: change to %s' % object.options[ 'state' ] ) |
|
Lines 653-659
Link Here
|
| 653 |
self.finished( object.id(), res ) |
654 |
self.finished( object.id(), res ) |
| 654 |
|
655 |
|
| 655 |
def uvmm_domain_create( self, object ): |
656 |
def uvmm_domain_create( self, object ): |
| 656 |
ud.debug( ud.ADMIN, ud.INFO, 'Domain create' ) |
657 |
ud.debug( ud.ADMIN, ud.INFO, 'Device create' ) |
| 657 |
( success, res ) = TreeView.safely_get_tree( self.uvmm, object, ( 'group', 'node', 'domain' ) ) |
658 |
( success, res ) = TreeView.safely_get_tree( self.uvmm, object, ( 'group', 'node', 'domain' ) ) |
| 658 |
if not success: |
659 |
if not success: |
| 659 |
self.finished(object.id(), res) |
660 |
self.finished(object.id(), res) |
|
Lines 661-674
Link Here
|
| 661 |
|
662 |
|
| 662 |
node_uri = self.uvmm.node_name2uri( object.options[ 'node' ] ) |
663 |
node_uri = self.uvmm.node_name2uri( object.options[ 'node' ] ) |
| 663 |
node = self.uvmm.get_node_info( node_uri ) |
664 |
node = self.uvmm.get_node_info( node_uri ) |
| 664 |
content = self._dlg_domain_settings( object, node, None ) |
|
|
| 665 |
|
665 |
|
| 666 |
res.dialog[ 0 ].set_dialog( umcd.Section( _( 'Add virtual instance' ), content, hideable = False ) ) |
666 |
self.domain_wizard.action( object, node ) |
|
|
667 |
page = self.domain_wizard.setup( object ) |
| 668 |
res.dialog[ 0 ].set_dialog( page ) |
| 667 |
|
669 |
|
| 668 |
self.finished(object.id(), res) |
670 |
self.finished(object.id(), res) |
|
|
671 |
# ud.debug( ud.ADMIN, ud.INFO, 'Domain create' ) |
| 672 |
# ( success, res ) = TreeView.safely_get_tree( self.uvmm, object, ( 'group', 'node', 'domain' ) ) |
| 673 |
# if not success: |
| 674 |
# self.finished(object.id(), res) |
| 675 |
# return |
| 669 |
|
676 |
|
|
|
677 |
# node_uri = self.uvmm.node_name2uri( object.options[ 'node' ] ) |
| 678 |
# node = self.uvmm.get_node_info( node_uri ) |
| 679 |
# content = self._dlg_domain_settings( object, node, None ) |
| 680 |
|
| 681 |
# res.dialog[ 0 ].set_dialog( umcd.Section( _( 'Add virtual instance' ), content, hideable = False ) ) |
| 682 |
|
| 683 |
# self.finished(object.id(), res) |
| 684 |
|
| 670 |
def uvmm_domain_remove_images( self, object ): |
685 |
def uvmm_domain_remove_images( self, object ): |
| 671 |
ud.debug( ud.ADMIN, ud.INFO, 'Domain remove images' ) |
686 |
ud.debug( ud.ADMIN, ud.INFO, 'Domain remove images' ) |
| 672 |
( success, res ) = TreeView.safely_get_tree( self.uvmm, object, ( 'group', 'node', 'domain' ) ) |
687 |
( success, res ) = TreeView.safely_get_tree( self.uvmm, object, ( 'group', 'node', 'domain' ) ) |
| 673 |
if not success: |
688 |
if not success: |
| 674 |
self.finished(object.id(), res) |
689 |
self.finished(object.id(), res) |
|
Lines 694-700
Link Here
|
| 694 |
lst.add_row( [ umcd.Cell( umcd.Text( '' ), attributes = { 'width' : '10' } ), umcd.Cell( chk_button, attributes = { 'colspan' : '2' } ) ] ) |
709 |
lst.add_row( [ umcd.Cell( umcd.Text( '' ), attributes = { 'width' : '10' } ), umcd.Cell( chk_button, attributes = { 'colspan' : '2' } ) ] ) |
| 695 |
|
710 |
|
| 696 |
opts = copy.copy( object.options ) |
711 |
opts = copy.copy( object.options ) |
| 697 |
opts[ 'drives' ] = [] |
712 |
opts[ 'drives' ] = [] |
| 698 |
back = umcp.SimpleCommand( 'uvmm/domain/overview', options = opts ) |
713 |
back = umcp.SimpleCommand( 'uvmm/domain/overview', options = opts ) |
| 699 |
req = umcp.SimpleCommand( 'uvmm/domain/remove', options = opts ) |
714 |
req = umcp.SimpleCommand( 'uvmm/domain/remove', options = opts ) |
| 700 |
fail_overview_cmd = umcp.SimpleCommand( 'uvmm/domain/overview', options = opts ) |
715 |
fail_overview_cmd = umcp.SimpleCommand( 'uvmm/domain/overview', options = opts ) |
|
Lines 703-717
Link Here
|
| 703 |
button = umcd.Button( _( 'Remove' ), actions = [ umcd.Action( req, boxes ), umcd.Action( success_overview_cmd, status_range = umcd.Action.SUCCESS ), umcd.Action( fail_overview_cmd, status_range = umcd.Action.FAILURE ) ] ) |
718 |
button = umcd.Button( _( 'Remove' ), actions = [ umcd.Action( req, boxes ), umcd.Action( success_overview_cmd, status_range = umcd.Action.SUCCESS ), umcd.Action( fail_overview_cmd, status_range = umcd.Action.FAILURE ) ] ) |
| 704 |
lst.add_row( [ '' ] ) |
719 |
lst.add_row( [ '' ] ) |
| 705 |
lst.add_row( [ umcd.Cell( cancel, attributes = { 'align' : 'right', 'colspan' : '2' } ), umcd.Cell( button, attributes = { 'align' : 'right' } ) ] ) |
720 |
lst.add_row( [ umcd.Cell( cancel, attributes = { 'align' : 'right', 'colspan' : '2' } ), umcd.Cell( button, attributes = { 'align' : 'right' } ) ] ) |
| 706 |
|
721 |
|
| 707 |
res.dialog[ 0 ].set_dialog( umcd.Section( _( 'Remove the virtual instance %(instance)s?' ) % { 'instance' : domain_info.name }, lst, hideable = False ) ) |
722 |
res.dialog[ 0 ].set_dialog( umcd.Section( _( 'Remove the virtual instance %(instance)s?' ) % { 'instance' : domain_info.name }, lst, hideable = False ) ) |
| 708 |
self.finished(object.id(), res) |
723 |
self.finished(object.id(), res) |
| 709 |
|
724 |
|
| 710 |
def uvmm_domain_remove( self, object ): |
725 |
def uvmm_domain_remove( self, object ): |
| 711 |
ud.debug( ud.ADMIN, ud.INFO, 'Domain remove' ) |
726 |
ud.debug( ud.ADMIN, ud.INFO, 'Domain remove' ) |
| 712 |
res = umcp.Response( object ) |
727 |
res = umcp.Response( object ) |
| 713 |
|
728 |
|
| 714 |
|
729 |
|
| 715 |
# remove domain |
730 |
# remove domain |
| 716 |
node_uri = self.uvmm.node_name2uri( object.options[ 'node' ] ) |
731 |
node_uri = self.uvmm.node_name2uri( object.options[ 'node' ] ) |
| 717 |
domain_info = self.uvmm.get_domain_info( node_uri, object.options[ 'domain' ] ) |
732 |
domain_info = self.uvmm.get_domain_info( node_uri, object.options[ 'domain' ] ) |
|
Lines 725-738
Link Here
|
| 725 |
self.finished( object.id(), res, report = _( 'The instance <i>%(domain)s</i> was removed successfully' ) % { 'domain' : object.options[ 'domain' ] } ) |
740 |
self.finished( object.id(), res, report = _( 'The instance <i>%(domain)s</i> was removed successfully' ) % { 'domain' : object.options[ 'domain' ] } ) |
| 726 |
|
741 |
|
| 727 |
def uvmm_device_create( self, object ): |
742 |
def uvmm_device_create( self, object ): |
| 728 |
ud.debug( ud.ADMIN, ud.INFO, 'Device create' ) |
743 |
ud.debug( ud.ADMIN, ud.INFO, 'Device create' ) |
| 729 |
( success, res ) = TreeView.safely_get_tree( self.uvmm, object, ( 'group', 'node', 'domain' ) ) |
744 |
( success, res ) = TreeView.safely_get_tree( self.uvmm, object, ( 'group', 'node', 'domain' ) ) |
| 730 |
if not success: |
745 |
if not success: |
| 731 |
self.finished(object.id(), res) |
746 |
self.finished(object.id(), res) |
| 732 |
return |
747 |
return |
|
|
748 |
node_uri = self.uvmm.node_name2uri( object.options[ 'node' ] ) |
| 749 |
node = self.uvmm.get_node_info( node_uri ) |
| 733 |
|
750 |
|
| 734 |
self.device_wizard.action( object ) |
751 |
self.device_wizard.action( object, node ) |
| 735 |
page = self.device_wizard.setup( object ) |
752 |
page = self.device_wizard.setup( object ) |
| 736 |
res.dialog[ 0 ].set_dialog( page ) |
753 |
res.dialog[ 0 ].set_dialog( page ) |
| 737 |
|
754 |
|
| 738 |
self.finished(object.id(), res) |
755 |
self.finished(object.id(), res) |