Ejemplo n.º 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'
         )
Ejemplo n.º 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)
Ejemplo n.º 3
0
	def modify_vm(cls, token, args):
		vmlist = VMList(token)
		vm = vmlist.getServer(vmid=args.id, name=args.name)
		if vm:
			vm.resize(args.planid)
Ejemplo n.º 4
0
	def delete_vm(cls, token, args):
		vmlist = VMList(token)
		vm = vmlist.getServer(vmid=args.id, name=args.name)
		if vm:
			vmlist.delete(vm.vmid)
Ejemplo n.º 5
0
	def reboot_vm(cls, token, args):
		vmlist = VMList(token)
		vm = vmlist.getServer(vmid=args.id, name=args.name)
		if vm:
			vm.restart()
Ejemplo n.º 6
0
	def stop_vm(cls, token, args):
		vmlist = VMList(token)
		vm = vmlist.getServer(vmid=args.id, name=args.name)
		if vm:
			vm.stop(args.force)