예제 #1
0
 def _vmlist(cls, token, args) -> typing.Iterable[conoha.compute.VM]:
     vmlist = VMList(token)
     if args.names:
         for name in args.names:
             vm = vmlist.getServer(vmid=name, name=name)
             if vm is None:
                 raise error.VMNotFound(name)
             yield vm
     elif args.id or args.name:
         vm = vmlist.getServer(vmid=args.id, name=args.name)
         if vm is None:
             raise error.VMNotFound(args.id or args.name)
         yield vm
     else:
         raise error.InvalidArgumentError(
             'argument is not specified: must specify the --name, --id or NAME positional argument'
         )
예제 #2
0
 def create_image(cls, token, args):
     vmlist = VMList(token)
     vm = vmlist.getServer(vmid=args.id, name=args.name)
     if vm:
         vm.createImage(args.image_name)
예제 #3
0
파일: cli.py 프로젝트: yuuki0xff/conoha-cli
	def modify_vm(cls, token, args):
		vmlist = VMList(token)
		vm = vmlist.getServer(vmid=args.id, name=args.name)
		if vm:
			vm.resize(args.planid)
예제 #4
0
파일: cli.py 프로젝트: yuuki0xff/conoha-cli
	def delete_vm(cls, token, args):
		vmlist = VMList(token)
		vm = vmlist.getServer(vmid=args.id, name=args.name)
		if vm:
			vmlist.delete(vm.vmid)
예제 #5
0
파일: cli.py 프로젝트: yuuki0xff/conoha-cli
	def reboot_vm(cls, token, args):
		vmlist = VMList(token)
		vm = vmlist.getServer(vmid=args.id, name=args.name)
		if vm:
			vm.restart()
예제 #6
0
파일: cli.py 프로젝트: yuuki0xff/conoha-cli
	def stop_vm(cls, token, args):
		vmlist = VMList(token)
		vm = vmlist.getServer(vmid=args.id, name=args.name)
		if vm:
			vm.stop(args.force)