Revision b0ddfd38 src/cli/onevm

View differences:

src/cli/onevm
416 416

  
417 417
    States: ANY, except SUSPENDED or DONE
418 418

  
419
* chown (Changes the VM owner and group)
420
    onevm chown <vm_id> <owner_id> [<group_id>]
421

  
422
* chgrp (Changes the VM group)
423
    onevm chgrp <vm_id> <group_id>
424

  
419 425
* list (Shows VMs in the pool)
420 426
    onevm list <filter_flag>
421 427

  
......
770 776
        end
771 777
    end
772 778

  
779
when "chown"
780
    check_parameters("chown", 2)
781

  
782
    obj_id  = get_vm_id(ARGV[0])
783
    new_uid = ARGV[1].to_i
784
    new_gid = ( ARGV.length > 2 ) ? ARGV[2].to_i : -1
785

  
786
    obj = OpenNebula::VirtualMachine.new_with_id(obj_id, get_one_client)
787

  
788
    result = obj.chown( new_uid, new_gid )
789
    if is_successful?(result)
790
        puts "VM user/group changed" if ops[:verbose]
791
    end
792

  
793
when "chgrp"
794
    check_parameters("chgrp", 2)
795

  
796
    obj_id = get_vm_id(ARGV[0])
797
    new_uid  = -1
798
    new_gid  = ARGV[1].to_i
799

  
800
    obj = OpenNebula::VirtualMachine.new_with_id(obj_id, get_one_client)
801

  
802
    result = obj.chown( new_uid, new_gid )
803
    if is_successful?(result)
804
        puts "VM group changed" if ops[:verbose]
805
    end
806

  
773 807
when "list"
774 808
    ops.merge!(get_user_flags)
775 809
    if !ops[:xml]

Also available in: Unified diff