Revision 061ea1b3

View differences:

include/RequestManager.h
41 41
{
42 42
public:
43 43

  
44
    RequestManager(
45
        VirtualMachinePool *    _vmpool,
46
        HostPool *              _hpool,
47
        VirtualNetworkPool *    _vnpool,
48
        UserPool           *    _upool,
49
        ImagePool          *    _ipool,
50
        ClusterPool        *    _cpool,
51
        VMTemplatePool     *    _tpool,
52
        GroupPool          *    _gpool,
53
        int                     _port,
54
        string                  _xml_log_file)
55
            :vmpool(_vmpool),hpool(_hpool),vnpool(_vnpool),upool(_upool),
56
            ipool(_ipool),cpool(_cpool),tpool(_tpool),gpool(_gpool),port(_port),
57
            socket_fd(-1),xml_log_file(_xml_log_file)
44
    RequestManager(int _port, const string _xml_log_file)
45
            :port(_port), socket_fd(-1), xml_log_file(_xml_log_file)
58 46
    {
59 47
        am.addListener(this);
60 48
    };
61 49

  
62
    ~RequestManager()
63
    {}
64
    ;
50
    ~RequestManager(){}; 
65 51

  
66 52
    /**
67 53
     *  This functions starts the associated listener thread (XML server), and
......
88 74
        am.trigger(ACTION_FINALIZE,0);
89 75
    };
90 76

  
91
    enum ErrorCode {
92
        AUTHENTICATION = 0x0100,
93
        AUTHORIZATION  = 0x0200,
94
        GET          = 0x0400,
95
        ACTION       = 0x0800
96
    };
97 77

  
98 78
private:
99 79

  
......
116 96
    pthread_t               rm_xml_server_thread;
117 97

  
118 98
    /**
119
     *  Pointer to the VM Pool, to access Virtual Machines
120
     */
121
    VirtualMachinePool *    vmpool;
122

  
123
    /**
124
     *  Pointer to the Host Pool, to access hosts
125
     */
126
    HostPool           *    hpool;
127

  
128
    /**
129
     *  Pointer to the VN Pool, to access Virtual Netowrks
130
     */
131
    VirtualNetworkPool *    vnpool;
132

  
133
    /**
134
     *  Pointer to the User Pool, to access users
135
     */
136
    UserPool           *    upool;
137

  
138
    /**
139
     *  Pointer to the Image Pool, to access images
140
     */
141
    ImagePool          *    ipool;
142

  
143
    /**
144
     *  Pointer to the Cluster Pool, to access clusters
145
     */
146
    ClusterPool        *    cpool;
147

  
148
    /**
149
     *  Pointer to the Template Pool, to access templates
150
     */
151
    VMTemplatePool     *    tpool;
152

  
153
    /**
154
     *  Pointer to the Group Pool, to access groups
155
     */
156
    GroupPool          *    gpool;
157

  
158
    /**
159 99
     *  Port number where the connection will be open
160 100
     */
161 101
    int port;
......
192 132
     */
193 133
    void do_action(const string & action, void * arg);
194 134

  
195
    void register_xml_methods();
196

  
197
    int setup_socket();
198

  
199
    // ----------------------------------------------------------------------
200
    // ----------------------------------------------------------------------
201
    //                          Error Messages
202
    // ----------------------------------------------------------------------
203
    // ----------------------------------------------------------------------
204

  
205

  
206
    /**
207
     *  Logs authorization errors
208
     *    @param method name of the RM method where the error arose
209
     *    @param action authorization action
210
     *    @param object object that needs to be authorized
211
     *    @param uid user that is authorized
212
     *    @param id id of the object, -1 for Pool
213
     *    @returns string for logging
214
     */
215
    static string authorization_error (const string& method,
216
                                       const string &action,
217
                                       const string &object,
218
                                       int   uid,
219
                                       int   id)
220
    {
221
        ostringstream oss;
222
        oss << "[" << method << "]" << " User [" << uid << "] not authorized"
223
            << " to perform " << action << " on " << object;
224

  
225

  
226
        if ( id != -1 )
227
        {
228
            oss << " [" << id << "].";
229
        }
230
        else
231
        {
232
            oss << " Pool";
233
        }
234

  
235
        return oss.str();
236
    }
237

  
238 135
    /**
239
     *  Logs authenticate errors
240
     *    @param method name of the RM method where the error arose
241
     *    @returns string for logging
136
     *  Register the XML-RPC API Calls
242 137
     */
243
    static string authenticate_error (const string& method)
244
    {
245
        ostringstream oss;
246

  
247
        oss << "[" << method << "]" << " User couldn't be authenticated," <<
248
               " aborting call.";
249

  
250
        return oss.str();
251
    }
252

  
253
    /**
254
     *  Logs get object errors
255
     *    @param method name of the RM method where the error arose
256
     *    @param object over which the get failed
257
     *    @param id of the object over which the get failed
258
     *    @returns string for logging
259
     */
260
    static string get_error (const string& method,
261
                             const string &object,
262
                             int id)
263
    {
264
        ostringstream oss;
265

  
266
        oss << "[" << method << "]" << " Error getting " <<
267
               object;
268

  
269
       if ( id != -1 )
270
       {
271
           oss << " [" << id << "].";
272
       }
273
       else
274
       {
275
          oss << " Pool.";
276
       }
277

  
278
       return oss.str();
279
    }
280

  
281
    /**
282
     *  Logs action errors
283
     *    @param method name of the RM method where the error arose
284
     *    @param action that triggered the error
285
     *    @param object over which the action was applied
286
     *    @param id id of the object, -1 for Pool, -2 for no-id objects
287
     *              (allocate error, parse error)
288
     *    @param rc returned error code (NULL to ignore)
289
     *    @returns string for logging
290
     */
291
    static string action_error (const string& method,
292
                                const string &action,
293
                                const string &object,
294
                                int id,
295
                                int rc)
296
    {
297
        ostringstream oss;
298

  
299
        oss << "[" << method << "]" << " Error trying to " << action << " "
300
            << object;
301

  
302
        switch(id)
303
        {
304
            case -2:
305
                break;
306
            case -1:
307
                oss << "Pool.";
308
                break;
309
            default:
310
                oss << " [" << id << "].";
311
                break;
312
        }
313

  
314
        if ( rc != 0 )
315
        {
316
            oss << " Returned error code [" << rc << "].";
317
        }
318

  
319
        return oss.str();
320
    }
321

  
322

  
323
    // ----------------------------------------------------------------------
324
    // ----------------------------------------------------------------------
325
    //                          Constants
326
    // ----------------------------------------------------------------------
327
    // ----------------------------------------------------------------------
328

  
329
    // TODO: enum of Objects is maintained in AuthManager.h, could be moved
330
    // to Nebula.h
331
    enum Object
332
    {
333
        VM,
334
        HOST,
335
        NET,
336
        IMAGE,
337
        USER,
338
        CLUSTER,
339
        TEMPLATE,
340
        GROUP
341
    };
342

  
343
    PoolSQL * get_pool(Object ob)
344
    {
345
        switch (ob)
346
        {
347
            case VM:       return static_cast<PoolSQL*>(vmpool);
348
            case HOST:     return static_cast<PoolSQL*>(hpool);
349
            case NET:      return static_cast<PoolSQL*>(vnpool);
350
            case IMAGE:    return static_cast<PoolSQL*>(ipool);
351
            case USER:     return static_cast<PoolSQL*>(upool);
352
            case CLUSTER:  return static_cast<PoolSQL*>(cpool);
353
            case TEMPLATE: return static_cast<PoolSQL*>(tpool);
354
            case GROUP:    return static_cast<PoolSQL*>(gpool);
355
        }
356
    };
357

  
358
    string get_method_prefix(Object ob)
359
    {
360
        switch (ob)
361
        {
362
            case VM:       return "VirtualMachine";
363
            case HOST:     return "Host";
364
            case NET:      return "VirtualNetwork";
365
            case IMAGE:    return "Image";
366
            case USER:     return "User";
367
            case CLUSTER:  return "Cluster";
368
            case TEMPLATE: return "Template";
369
            case GROUP:    return "Group";
370
        }
371
    };
372

  
373
    string get_object_name(Object ob)
374
    {
375
        switch (ob)
376
        {
377
            case VM:       return "VM";
378
            case HOST:     return "HOST";
379
            case NET:      return "NET";
380
            case IMAGE:    return "IMAGE";
381
            case USER:     return "USER";
382
            case CLUSTER:  return "CLUSTER";
383
            case TEMPLATE: return "TEMPLATE";
384
            case GROUP:    return "GROUP";
385
        }
386
    };
387

  
388
    // ----------------------------------------------------------------------
389
    // ----------------------------------------------------------------------
390
    //                          XML-RPC Methods
391
    // ----------------------------------------------------------------------
392
    // ----------------------------------------------------------------------
393

  
394
    /* ---------------------------------------------------------------------- */
395
    /*                     Generic Helpers                                    */
396
    /* ---------------------------------------------------------------------- */
397

  
398
    class GenericChown: public xmlrpc_c::method
399
    {
400
    public:
401
        GenericChown(RequestManager  *  _rm,
402
                     Object             _ob):
403
                        rm(_rm),
404
                        ob(_ob)
405
        {
406
            _signature="A:siii";
407
            _help="Changes the owner and/or group";
408
        };
409

  
410
        ~GenericChown(){};
411

  
412
        void execute(
413
            xmlrpc_c::paramList const& paramList,
414
            xmlrpc_c::value *   const  retvalP);
415

  
416
    private:
417
        RequestManager *    rm;
418
        Object              ob;
419
    };
420

  
421
    /* ---------------------------------------------------------------------- */
422
    /*                     Virtual Machine Interface                          */
423
    /* ---------------------------------------------------------------------- */
424
    class VirtualMachineAllocate: public xmlrpc_c::method
425
    {
426
    public:
427
        VirtualMachineAllocate(
428
            VirtualMachinePool * _vmpool,
429
            VirtualNetworkPool * _vnpool,
430
            ImagePool          * _ipool,
431
            VMTemplatePool     * _tpool,
432
            UserPool           * _upool):
433
        vmpool(_vmpool),
434
        vnpool(_vnpool),
435
        ipool(_ipool),
436
        tpool(_tpool),
437
        upool(_upool)
438
        {
439
            _signature="A:ss";
440
            _help="Allocates a virtual machine in the pool";
441
        };
442

  
443
        ~VirtualMachineAllocate(){};
444

  
445
        void execute(
446
            xmlrpc_c::paramList const& paramList,
447
            xmlrpc_c::value *   const  retval);
448
    private:
449
        VirtualMachinePool * vmpool;
450
        VirtualNetworkPool * vnpool;
451
        ImagePool          * ipool;
452
        VMTemplatePool     * tpool;
453
        UserPool           * upool;
454
    };
455

  
456
    /* ---------------------------------------------------------------------- */
457

  
458
    class VirtualMachineDeploy: public xmlrpc_c::method
459
    {
460
    public:
461
        VirtualMachineDeploy(
462
            VirtualMachinePool * _vmpool,
463
            HostPool           * _hpool,
464
            UserPool           * _upool):
465
                vmpool(_vmpool),
466
                hpool(_hpool),
467
                upool(_upool)
468
        {
469
            _signature="A:sii";
470
            _help="Deploys a virtual machine";
471
        };
472

  
473
        ~VirtualMachineDeploy(){};
474

  
475
        void execute(
476
            xmlrpc_c::paramList const& paramList,
477
            xmlrpc_c::value *   const  retval);
478

  
479
    private:
480
        VirtualMachinePool * vmpool;
481
        HostPool           * hpool;
482
        UserPool           * upool;
483
    };
484

  
485
    /* ---------------------------------------------------------------------- */
486

  
487
    class VirtualMachineAction: public xmlrpc_c::method
488
    {
489
    public:
490
        VirtualMachineAction(
491
            VirtualMachinePool * _vmpool,
492
            UserPool * _upool):
493
                vmpool(_vmpool),
494
                upool(_upool)
495
        {
496
            _signature="A:ssi";
497
            _help="Performs an action on a virtual machine";
498
        };
499

  
500
        ~VirtualMachineAction(){};
501

  
502
        void execute(
503
            xmlrpc_c::paramList const& paramList,
504
            xmlrpc_c::value *   const  retval);
505

  
506
    private:
507
        VirtualMachinePool * vmpool;
508
        UserPool *           upool;
509
    };
510

  
511
    /* ---------------------------------------------------------------------- */
512

  
513
    class VirtualMachineMigrate: public xmlrpc_c::method
514
    {
515
    public:
516
        VirtualMachineMigrate(
517
            VirtualMachinePool * _vmpool,
518
            HostPool *           _hpool,
519
            UserPool *           _upool):
520
                vmpool(_vmpool),
521
                hpool(_hpool),
522
                upool(_upool)
523
        {
524
            _signature="A:siib";
525
            _help="Migrates a virtual machine";
526
        };
527

  
528
        ~VirtualMachineMigrate(){};
529

  
530
        void execute(
531
            xmlrpc_c::paramList const& paramList,
532
            xmlrpc_c::value *   const  retval);
533

  
534
    private:
535
        VirtualMachinePool * vmpool;
536
        HostPool *           hpool;
537
        UserPool *           upool;
538
    };
539

  
540
    /* ---------------------------------------------------------------------- */
541

  
542
    class VirtualMachineInfo: public xmlrpc_c::method
543
    {
544
    public:
545
        VirtualMachineInfo(
546
            VirtualMachinePool * _vmpool,
547
            UserPool           * _upool):
548
                vmpool(_vmpool),
549
                upool(_upool)
550
        {
551
            _signature="A:si";
552
            _help="Returns virtual machine information";
553
        };
554

  
555
        ~VirtualMachineInfo(){};
556

  
557
        void execute(
558
            xmlrpc_c::paramList const& paramList,
559
            xmlrpc_c::value *   const  retval);
560

  
561
    private:
562
        VirtualMachinePool * vmpool;
563
        UserPool           * upool;
564
    };
565

  
566
    /* ---------------------------------------------------------------------- */
567

  
568
    class VirtualMachineSaveDisk: public xmlrpc_c::method
569
    {
570
    public:
571
        VirtualMachineSaveDisk(
572
            VirtualMachinePool * _vmpool,
573
            UserPool           * _upool,
574
            ImagePool          * _ipool):
575
                vmpool(_vmpool),
576
                upool(_upool),
577
                ipool(_ipool)
578
        {
579
            _signature="A:siis";
580
            _help = "Sets the disk to be saved in a new Image with the given "
581
                    "name.";
582
        };
583

  
584
        ~VirtualMachineSaveDisk(){};
585

  
586
        void execute(
587
            xmlrpc_c::paramList const& paramList,
588
            xmlrpc_c::value *   const  retval);
589

  
590
    private:
591
        VirtualMachinePool * vmpool;
592
        UserPool           * upool;
593
        ImagePool          * ipool;
594
    };
595

  
596
    /* ---------------------------------------------------------------------- */
597

  
598
    class VirtualMachinePoolInfo: public xmlrpc_c::method
599
    {
600
    public:
601
        VirtualMachinePoolInfo(
602
            VirtualMachinePool * _vmpool,
603
            UserPool           * _upool):
604
                vmpool(_vmpool),
605
                upool(_upool)
606
        {
607
            _signature="A:sii";
608
            _help="Returns the virtual machine pool";
609
        };
610

  
611
        ~VirtualMachinePoolInfo(){};
612

  
613
        void execute(
614
            xmlrpc_c::paramList const& paramList,
615
            xmlrpc_c::value *   const  retval);
616

  
617
    private:
618
        VirtualMachinePool * vmpool;
619
        UserPool           *  upool;
620
    };
621

  
622
    /* ---------------------------------------------------------------------- */
623
    /*                            Template Interface                          */
624
    /* ---------------------------------------------------------------------- */
625

  
626
    class TemplateAllocate: public xmlrpc_c::method
627
    {
628
    public:
629
        TemplateAllocate(
630
            VMTemplatePool * _tpool,
631
            UserPool * _upool):
632
                tpool(_tpool),
633
                upool(_upool)
634
        {
635
            _signature="A:ss";
636
            _help="Allocates a template in the pool";
637
        };
638

  
639
        ~TemplateAllocate(){};
640

  
641
        void execute(
642
            xmlrpc_c::paramList const& paramList,
643
            xmlrpc_c::value *   const  retvalP);
644

  
645
    private:
646
        VMTemplatePool * tpool;
647
        UserPool *       upool;
648
    };
649

  
650
    /* ---------------------------------------------------------------------- */
651

  
652
    class TemplateDelete: public xmlrpc_c::method
653
    {
654
    public:
655
        TemplateDelete(VMTemplatePool * _tpool,
656
                       UserPool *       _upool):
657
                            tpool(_tpool),
658
                            upool(_upool)
659
        {
660
            _signature="A:si";
661
            _help="Deletes a Template";
662
        };
663

  
664
        ~TemplateDelete(){};
665

  
666
        void execute(
667
            xmlrpc_c::paramList const& paramList,
668
            xmlrpc_c::value *   const  retvalP);
669

  
670
    private:
671
        VMTemplatePool * tpool;
672
        UserPool  *      upool;
673
    };
674

  
675
    /* ---------------------------------------------------------------------- */
676

  
677
    class TemplateInfo: public xmlrpc_c::method
678
    {
679
    public:
680
        TemplateInfo(VMTemplatePool * _tpool,
681
                     UserPool *       _upool):
682
                      tpool(_tpool),
683
                      upool(_upool)
684
        {
685
            _signature="A:si";
686
            _help="Returns information for a Template";
687
        };
688

  
689
        ~TemplateInfo(){};
690

  
691
        void execute(
692
            xmlrpc_c::paramList const& paramList,
693
            xmlrpc_c::value *   const  retvalP);
694

  
695
    private:
696
        VMTemplatePool * tpool;
697
        UserPool  *      upool;
698
    };
699

  
700
    /* ---------------------------------------------------------------------- */
701

  
702
    class TemplateUpdate: public xmlrpc_c::method
703
    {
704
    public:
705
        TemplateUpdate(VMTemplatePool * _tpool,
706
                       UserPool *       _upool):
707
                        tpool(_tpool),
708
                        upool(_upool)
709
        {
710
            _signature="A:siss";
711
            _help="Modifies Template attribute";
712
        };
713

  
714
        ~TemplateUpdate(){};
715

  
716
        void execute(
717
            xmlrpc_c::paramList const& paramList,
718
            xmlrpc_c::value *   const  retvalP);
719

  
720
    private:
721
        VMTemplatePool * tpool;
722
        UserPool  *      upool;
723
    };
724

  
725
    /* ---------------------------------------------------------------------- */
726

  
727
    class TemplateRemoveAttribute: public xmlrpc_c::method
728
    {
729
    public:
730
        TemplateRemoveAttribute(VMTemplatePool * _tpool,
731
                             UserPool *          _upool):
732
                        tpool(_tpool),
733
                        upool(_upool)
734
        {
735
            _signature="A:sis";
736
            _help="Removes Template attribute";
737
        };
738

  
739
        ~TemplateRemoveAttribute(){};
740

  
741
        void execute(
742
            xmlrpc_c::paramList const& paramList,
743
            xmlrpc_c::value *   const  retvalP);
744

  
745
    private:
746
        VMTemplatePool * tpool;
747
        UserPool  *      upool;
748
    };
749

  
750
    /* ---------------------------------------------------------------------- */
751

  
752
    class TemplatePublish: public xmlrpc_c::method
753
    {
754
    public:
755
        TemplatePublish(VMTemplatePool * _tpool,
756
                     UserPool *          _upool):
757
                        tpool(_tpool),
758
                        upool(_upool)
759
        {
760
            _signature="A:sib";
761
            _help="Publish/Unpublish the Template";
762
        };
763

  
764
        ~TemplatePublish(){};
765

  
766
        void execute(
767
            xmlrpc_c::paramList const& paramList,
768
            xmlrpc_c::value *   const  retvalP);
769

  
770
    private:
771
        VMTemplatePool * tpool;
772
        UserPool  *      upool;
773
    };
774

  
775
    /* ---------------------------------------------------------------------- */
776

  
777
    class TemplatePoolInfo: public xmlrpc_c::method
778
    {
779
    public:
780
        TemplatePoolInfo(
781
            VMTemplatePool * _tpool,
782
            UserPool * _upool):
783
                tpool(_tpool),
784
                upool(_upool)
785
        {
786
            _signature="A:sii";
787
            _help="Returns the template pool";
788
        };
789

  
790
        ~TemplatePoolInfo(){};
791

  
792
        void execute(
793
            xmlrpc_c::paramList const& paramList,
794
            xmlrpc_c::value *   const  retvalP);
795

  
796
    private:
797
        VMTemplatePool * tpool;
798
        UserPool *       upool;
799
    };
800

  
801
    /* ---------------------------------------------------------------------- */
802
    /*                            Host Interface                              */
803
    /* ---------------------------------------------------------------------- */
804

  
805
    class HostAllocate: public xmlrpc_c::method
806
    {
807
    public:
808
        HostAllocate(
809
            HostPool * _hpool,
810
            UserPool * _upool):
811
                hpool(_hpool),
812
                upool(_upool)
813
        {
814
            _signature="A:sssss";
815
            _help="Allocates a host in the pool";
816
        };
817

  
818
        ~HostAllocate(){};
819

  
820
        void execute(
821
            xmlrpc_c::paramList const& paramList,
822
            xmlrpc_c::value *   const  retvalP);
823

  
824
    private:
825
        HostPool * hpool;
826
        UserPool * upool;
827
    };
828

  
829
    /* ---------------------------------------------------------------------- */
830

  
831
    class HostInfo: public xmlrpc_c::method
832
    {
833
    public:
834
        HostInfo(
835
            HostPool * _hpool,
836
            UserPool * _upool):
837
                hpool(_hpool),
838
                upool(_upool)
839
        {
840
            _signature="A:si";
841
            _help="Returns host information";
842
        };
843

  
844
        ~HostInfo(){};
845

  
846
        void execute(
847
            xmlrpc_c::paramList const& paramList,
848
            xmlrpc_c::value *   const  retvalP);
849

  
850
    private:
851
        HostPool * hpool;
852
        UserPool * upool;
853
    };
854

  
855
    /* ---------------------------------------------------------------------- */
856

  
857
    class HostPoolInfo: public xmlrpc_c::method
858
    {
859
    public:
860
        HostPoolInfo(HostPool * _hpool,
861
                     UserPool * _upool):
862
            hpool(_hpool),
863
            upool(_upool)
864
        {
865
            _signature="A:s";
866
            _help="Returns the host pool information";
867
        };
868

  
869
        ~HostPoolInfo(){};
870

  
871
        void execute(
872
            xmlrpc_c::paramList const& paramList,
873
            xmlrpc_c::value *   const  retvalP);
874

  
875
    private:
876
        HostPool * hpool;
877
        UserPool * upool;
878
    };
879

  
880
    /* ---------------------------------------------------------------------- */
881

  
882
    class HostDelete: public xmlrpc_c::method
883
    {
884
    public:
885
        HostDelete(
886
            HostPool * _hpool,
887
            UserPool * _upool):
888
                hpool(_hpool),
889
                upool(_upool)
890
        {
891
            _signature="A:si";
892
            _help="Deletes a host from the pool";
893
        };
894

  
895
        ~HostDelete(){};
896

  
897
        void execute(
898
            xmlrpc_c::paramList const& paramList,
899
            xmlrpc_c::value *   const  retvalP);
900

  
901
    private:
902
        HostPool * hpool;
903
        UserPool * upool;
904
    };
905

  
906
    /* ---------------------------------------------------------------------- */
907

  
908
    class HostEnable: public xmlrpc_c::method
909
    {
910
    public:
911
        HostEnable(
912
            HostPool * _hpool,
913
            UserPool * _upool):
914
                hpool(_hpool),
915
                upool(_upool)
916
        {
917
            _signature="A:sib";
918
            _help="Enables or disables a host";
919
        };
920

  
921
        ~HostEnable(){};
922

  
923
        void execute(
924
            xmlrpc_c::paramList const& paramList,
925
            xmlrpc_c::value *   const  retvalP);
926

  
927
    private:
928
        HostPool * hpool;
929
        UserPool * upool;
930
    };
931

  
932
    /* ---------------------------------------------------------------------- */
933
    /*                      Cluster Interface                                 */
934
    /* ---------------------------------------------------------------------- */
935

  
936
    class ClusterAllocate: public xmlrpc_c::method
937
    {
938
    public:
939
        ClusterAllocate(
940
            UserPool *      _upool,
941
            ClusterPool *   _cpool):
942
                upool(_upool),
943
                cpool(_cpool)
944
        {
945
            _signature="A:ss";
946
            _help="Allocates a cluster in the pool";
947
        };
948

  
949
        ~ClusterAllocate(){};
950

  
951
        void execute(
952
            xmlrpc_c::paramList const& paramList,
953
            xmlrpc_c::value *   const  retvalP);
954

  
955
    private:
956
        UserPool *      upool;
957
        ClusterPool *   cpool;
958
    };
959

  
960
    /* ---------------------------------------------------------------------- */
961

  
962
    class ClusterInfo: public xmlrpc_c::method
963
    {
964
    public:
965
        ClusterInfo(
966
            UserPool *      _upool,
967
            ClusterPool *   _cpool):
968
                upool(_upool),
969
                cpool(_cpool)
970
        {
971
            _signature="A:si";
972
            _help="Returns cluster information";
973
        };
974

  
975
        ~ClusterInfo(){};
976

  
977
        void execute(
978
            xmlrpc_c::paramList const& paramList,
979
            xmlrpc_c::value *   const  retvalP);
980

  
981
    private:
982
        UserPool *      upool;
983
        ClusterPool *   cpool;
984
    };
985

  
986
    /* ---------------------------------------------------------------------- */
987

  
988
    class ClusterDelete: public xmlrpc_c::method
989
    {
990
    public:
991
        ClusterDelete(
992
            UserPool *      _upool,
993
            ClusterPool *   _cpool):
994
                upool(_upool),
995
                cpool(_cpool)
996
        {
997
            _signature="A:si";
998
            _help="Deletes a cluster from the pool";
999
        };
1000

  
1001
        ~ClusterDelete(){};
1002

  
1003
        void execute(
1004
            xmlrpc_c::paramList const& paramList,
1005
            xmlrpc_c::value *   const  retvalP);
1006

  
1007
    private:
1008
        UserPool *      upool;
1009
        ClusterPool *   cpool;
1010
    };
1011

  
1012
    /* ---------------------------------------------------------------------- */
1013

  
1014
    class ClusterAdd: public xmlrpc_c::method
1015
    {
1016
    public:
1017
        ClusterAdd(
1018
            HostPool *      _hpool,
1019
            UserPool *      _upool,
1020
            ClusterPool *   _cpool):
1021
                hpool(_hpool),
1022
                upool(_upool),
1023
                cpool(_cpool)
1024
        {
1025
            _signature="A:sii";
1026
            _help="Adds a host to a cluster";
1027
        };
1028

  
1029
        ~ClusterAdd(){};
1030

  
1031
        void execute(
1032
            xmlrpc_c::paramList const& paramList,
1033
            xmlrpc_c::value *   const  retvalP);
1034

  
1035
    private:
1036
        HostPool *      hpool;
1037
        UserPool *      upool;
1038
        ClusterPool *   cpool;
1039
    };
1040

  
1041
    /* ---------------------------------------------------------------------- */
1042

  
1043
    class ClusterRemove: public xmlrpc_c::method
1044
    {
1045
    public:
1046
        ClusterRemove(
1047
            HostPool *      _hpool,
1048
            UserPool *      _upool,
1049
            ClusterPool *   _cpool):
1050
                hpool(_hpool),
1051
                upool(_upool),
1052
                cpool(_cpool)
1053
        {
1054
            _signature="A:si";
1055
            _help="Removes a host from its cluster";
1056
        };
1057

  
1058
        ~ClusterRemove(){};
1059

  
1060
        void execute(
1061
            xmlrpc_c::paramList const& paramList,
1062
            xmlrpc_c::value *   const  retvalP);
1063

  
1064
    private:
1065
        HostPool *      hpool;
1066
        UserPool *      upool;
1067
        ClusterPool *   cpool;
1068
    };
1069

  
1070
    /* ---------------------------------------------------------------------- */
1071

  
1072
    class ClusterPoolInfo: public xmlrpc_c::method
1073
    {
1074
    public:
1075
        ClusterPoolInfo(
1076
            UserPool *      _upool,
1077
            ClusterPool *   _cpool):
1078
                upool(_upool),
1079
                cpool(_cpool)
1080
        {
1081
            _signature="A:s";
1082
            _help="Returns the cluster pool information";
1083
        };
1084

  
1085
        ~ClusterPoolInfo(){};
1086

  
1087
        void execute(
1088
            xmlrpc_c::paramList const& paramList,
1089
            xmlrpc_c::value *   const  retvalP);
1090

  
1091
    private:
1092
        UserPool *      upool;
1093
        ClusterPool *   cpool;
1094
    };
1095

  
1096

  
1097
    /* ---------------------------------------------------------------------- */
1098
    /*                      Group Interface                                   */
1099
    /* ---------------------------------------------------------------------- */
1100

  
1101
    class GroupAllocate: public xmlrpc_c::method
1102
    {
1103
    public:
1104
        GroupAllocate(
1105
            UserPool *      _upool,
1106
            GroupPool *     _gpool):
1107
                upool(_upool),
1108
                gpool(_gpool)
1109
        {
1110
            _signature="A:ss";
1111
            _help="Allocates a group in the pool";
1112
        };
1113

  
1114
        ~GroupAllocate(){};
1115

  
1116
        void execute(
1117
            xmlrpc_c::paramList const& paramList,
1118
            xmlrpc_c::value *   const  retvalP);
1119

  
1120
    private:
1121
        UserPool *      upool;
1122
        GroupPool *     gpool;
1123
    };
1124

  
1125
    /* ---------------------------------------------------------------------- */
1126

  
1127
    class GroupInfo: public xmlrpc_c::method
1128
    {
1129
    public:
1130
        GroupInfo(
1131
            UserPool *      _upool,
1132
            GroupPool *     _gpool):
1133
                upool(_upool),
1134
                gpool(_gpool)
1135
        {
1136
            _signature="A:si";
1137
            _help="Returns group information";
1138
        };
1139

  
1140
        ~GroupInfo(){};
1141

  
1142
        void execute(
1143
            xmlrpc_c::paramList const& paramList,
1144
            xmlrpc_c::value *   const  retvalP);
1145

  
1146
    private:
1147
        UserPool *      upool;
1148
        GroupPool *     gpool;
1149
    };
1150

  
1151
    /* ---------------------------------------------------------------------- */
1152

  
1153
    class GroupDelete: public xmlrpc_c::method
1154
    {
1155
    public:
1156
        GroupDelete(
1157
            UserPool *      _upool,
1158
            GroupPool *     _gpool):
1159
                upool(_upool),
1160
                gpool(_gpool)
1161
        {
1162
            _signature="A:si";
1163
            _help="Deletes a group from the pool";
1164
        };
1165

  
1166
        ~GroupDelete(){};
1167

  
1168
        void execute(
1169
            xmlrpc_c::paramList const& paramList,
1170
            xmlrpc_c::value *   const  retvalP);
1171

  
1172
    private:
1173
        UserPool *      upool;
1174
        GroupPool *     gpool;
1175
    };
1176

  
1177
    /* ---------------------------------------------------------------------- */
1178

  
1179
    class GroupPoolInfo: public xmlrpc_c::method
1180
    {
1181
    public:
1182
        GroupPoolInfo(
1183
            UserPool *      _upool,
1184
            GroupPool *     _gpool):
1185
                upool(_upool),
1186
                gpool(_gpool)
1187
        {
1188
            _signature="A:s";
1189
            _help="Returns the group pool information";
1190
        };
1191

  
1192
        ~GroupPoolInfo(){};
1193

  
1194
        void execute(
1195
            xmlrpc_c::paramList const& paramList,
1196
            xmlrpc_c::value *   const  retvalP);
1197

  
1198
    private:
1199
        UserPool *      upool;
1200
        GroupPool *     gpool;
1201
    };
1202

  
1203

  
1204
    /* ---------------------------------------------------------------------- */
1205
    /*                      Virtual Network Interface                         */
1206
    /* ---------------------------------------------------------------------- */
1207

  
1208

  
1209
    class VirtualNetworkAllocate: public xmlrpc_c::method
1210
    {
1211
    public:
1212
        VirtualNetworkAllocate(
1213
            VirtualNetworkPool * _vnpool,
1214
            UserPool *           _upool):
1215
                vnpool(_vnpool),
1216
                upool(_upool)
1217
        {
1218
            _signature="A:ss";
1219
            _help="Creates a virtual network";
1220
        };
1221

  
1222
        ~VirtualNetworkAllocate(){};
1223

  
1224
        void execute(
1225
            xmlrpc_c::paramList const& paramList,
1226
            xmlrpc_c::value *   const  retvalP);
1227

  
1228
    private:
1229
        VirtualNetworkPool * vnpool;
1230
        UserPool           * upool;
1231
    };
1232

  
1233
    /* ---------------------------------------------------------------------- */
1234

  
1235
    class VirtualNetworkInfo: public xmlrpc_c::method
1236
    {
1237
    public:
1238
        VirtualNetworkInfo(
1239
            VirtualNetworkPool * _vnpool,
1240
            UserPool           * _upool):
1241
                 vnpool(_vnpool),
1242
                 upool(_upool)
1243
        {
1244
            _signature="A:si";
1245
            _help="Returns virtual network information";
1246
        };
1247

  
1248
        ~VirtualNetworkInfo(){};
1249

  
1250
        void execute(
1251
            xmlrpc_c::paramList const& paramList,
1252
            xmlrpc_c::value *   const  retvalP);
1253

  
1254
    private:
1255
        VirtualNetworkPool * vnpool;
1256
        UserPool           * upool;
1257
    };
1258

  
1259
    /* ---------------------------------------------------------------------- */
1260

  
1261
    class VirtualNetworkPoolInfo: public xmlrpc_c::method
1262
    {
1263
    public:
1264
        VirtualNetworkPoolInfo(VirtualNetworkPool * _vnpool,
1265
                               UserPool           * _upool):
1266
            vnpool(_vnpool),
1267
            upool(_upool)
1268
        {
1269
            _signature="A:si";
1270
            _help="Returns the virtual network pool information";
1271
        };
1272

  
1273
        ~VirtualNetworkPoolInfo(){};
1274

  
1275
        void execute(
1276
            xmlrpc_c::paramList const& paramList,
1277
            xmlrpc_c::value *   const  retvalP);
1278

  
1279
    private:
1280
        VirtualNetworkPool * vnpool;
1281
        UserPool           * upool;
1282
    };
1283

  
1284
    /* ---------------------------------------------------------------------- */
1285

  
1286
    class VirtualNetworkPublish: public xmlrpc_c::method
1287
    {
1288
    public:
1289
        VirtualNetworkPublish(
1290
            VirtualNetworkPool * _vnpool,
1291
            UserPool           * _upool):
1292
                vnpool(_vnpool),
1293
                upool(_upool)
1294
        {
1295
            _signature="A:sib";
1296
            _help="Enables/Disables a virtual network";
1297
        };
1298

  
1299
        ~VirtualNetworkPublish(){};
1300

  
1301
        void execute(
1302
            xmlrpc_c::paramList const& paramList,
1303
            xmlrpc_c::value *   const  retvalP);
1304

  
1305
    private:
1306
        VirtualNetworkPool * vnpool;
1307
        UserPool           * upool;
1308
    };
1309

  
1310
    /* ---------------------------------------------------------------------- */
1311

  
1312
    class VirtualNetworkDelete: public xmlrpc_c::method
1313
    {
1314
    public:
1315
        VirtualNetworkDelete(
1316
            VirtualNetworkPool * _vnpool,
1317
            UserPool           * _upool):
1318
                vnpool(_vnpool),
1319
                upool(_upool)
1320
        {
1321
            _signature="A:si";
1322
            _help="Deletes a virtual network";
1323
        };
1324

  
1325
        ~VirtualNetworkDelete(){};
1326

  
1327
        void execute(
1328
            xmlrpc_c::paramList const& paramList,
1329
            xmlrpc_c::value *   const  retvalP);
1330

  
1331
    private:
1332
        VirtualNetworkPool * vnpool;
1333
        UserPool           * upool;
1334
    };
1335

  
1336
    /* ---------------------------------------------------------------------- */
1337

  
1338
    class VirtualNetworkAddLeases: public xmlrpc_c::method
1339
    {
1340
    public:
1341
        VirtualNetworkAddLeases(
1342
            VirtualNetworkPool * _vnpool,
1343
            UserPool           * _upool):
1344
                vnpool(_vnpool),
1345
                upool(_upool)
1346
        {
1347
            _signature="A:sis";
1348
            _help="Adds leases to a virtual network";
1349
        };
1350

  
1351
        ~VirtualNetworkAddLeases(){};
1352

  
1353
        void execute(
1354
            xmlrpc_c::paramList const& paramList,
1355
            xmlrpc_c::value *   const  retvalP);
1356

  
1357
    private:
1358
        VirtualNetworkPool * vnpool;
1359
        UserPool           * upool;
1360
    };
1361

  
1362
    /* ---------------------------------------------------------------------- */
1363

  
1364
    class VirtualNetworkRemoveLeases: public xmlrpc_c::method
1365
    {
1366
    public:
1367
        VirtualNetworkRemoveLeases(
1368
            VirtualNetworkPool * _vnpool,
1369
            UserPool           * _upool):
1370
                vnpool(_vnpool),
1371
                upool(_upool)
1372
        {
1373
            _signature="A:sis";
1374
            _help="Removes leases from a virtual network";
1375
        };
1376

  
1377
        ~VirtualNetworkRemoveLeases(){};
1378

  
1379
        void execute(
1380
            xmlrpc_c::paramList const& paramList,
1381
            xmlrpc_c::value *   const  retvalP);
1382

  
1383
    private:
1384
        VirtualNetworkPool * vnpool;
1385
        UserPool           * upool;
1386
    };
1387
    /* ---------------------------------------------------------------------- */
1388
    /*                      User Management Interface                         */
1389
    /* ---------------------------------------------------------------------- */
1390

  
1391

  
1392
    class UserAllocate: public xmlrpc_c::method
1393
    {
1394
    public:
1395
        UserAllocate(UserPool * _upool):upool(_upool)
1396
        {
1397
            _signature="A:sss";
1398
            _help="Creates a new user";
1399
        };
1400

  
1401
        ~UserAllocate(){};
1402

  
1403
        void execute(
1404
            xmlrpc_c::paramList const& paramList,
1405
            xmlrpc_c::value *   const  retvalP);
1406

  
1407
    private:
1408
        UserPool * upool;
1409
    };
1410

  
1411
    /* ---------------------------------------------------------------------- */
1412

  
1413
    class UserDelete: public xmlrpc_c::method
1414
    {
1415
    public:
1416
        UserDelete(UserPool * _upool):upool(_upool)
1417
        {
1418
            _signature="A:si";
1419
            _help="Deletes a user account";
1420
        };
1421

  
1422
        ~UserDelete(){};
1423

  
1424
        void execute(
1425
            xmlrpc_c::paramList const& paramList,
1426
            xmlrpc_c::value *   const  retvalP);
1427

  
1428
    private:
1429
        UserPool * upool;
1430
    };
1431

  
1432
    /* ---------------------------------------------------------------------- */
1433

  
1434
    class UserChangePassword: public xmlrpc_c::method
1435
    {
1436
    public:
1437
        UserChangePassword(UserPool * _upool):upool(_upool)
1438
        {
1439
            _signature="A:sis";
1440
            _help="Changes the password for the given user.";
1441
        };
1442

  
1443
        ~UserChangePassword(){};
1444

  
1445
        void execute(
1446
            xmlrpc_c::paramList const& paramList,
1447
            xmlrpc_c::value *   const  retvalP);
1448

  
1449
    private:
1450
        UserPool * upool;
1451
    };
1452

  
1453
    /* ---------------------------------------------------------------------- */
1454

  
1455
    class UserInfo: public xmlrpc_c::method                                   
1456
    {
1457
    public:                                                                   
1458
        UserInfo(UserPool * _upool):upool(_upool)
1459
        {
1460
            _signature="A:si";
1461
            _help="Returns the information for a user";
1462
        };
1463

  
1464
        ~UserInfo(){};
1465

  
1466
        void execute(
1467
            xmlrpc_c::paramList const& paramList,
1468
            xmlrpc_c::value *   const  retvalP);
1469

  
1470
    private:
1471
        UserPool * upool;
1472
    };
1473

  
1474
    /* ---------------------------------------------------------------------- */
1475

  
1476
    class UserPoolInfo: public xmlrpc_c::method
1477
    {
1478
    public:
1479
        UserPoolInfo(UserPool * _upool):upool(_upool)
1480
        {
1481
            _signature="A:s";
1482
            _help="Returns content of the user pool";
1483
        };
1484

  
1485
        ~UserPoolInfo(){};
1486

  
1487
        void execute(
1488
            xmlrpc_c::paramList const& paramList,
1489
            xmlrpc_c::value *   const  retvalP);
1490

  
1491
    private:
1492
        UserPool * upool;
1493
    };
1494

  
1495
    /* ---------------------------------------------------------------------- */
1496
    /*                      Image Pool Interface                              */
1497
    /* ---------------------------------------------------------------------- */
1498

  
1499
    class ImageAllocate: public xmlrpc_c::method
1500
    {
1501
    public:
1502
        ImageAllocate(ImagePool * _ipool,
1503
                      UserPool * _upool):
1504
                            ipool(_ipool),
1505
                            upool(_upool)
1506
        {
1507
            _signature="A:ss";
1508
            _help="Creates a new image";
1509
        };
1510

  
1511
        ~ImageAllocate(){};
1512

  
1513
        void execute(
1514
            xmlrpc_c::paramList const& paramList,
1515
            xmlrpc_c::value *   const  retvalP);
1516

  
1517
    private:
1518
        ImagePool * ipool;
1519
        UserPool  * upool;
1520
    };
1521

  
1522
    /* ---------------------------------------------------------------------- */
1523

  
1524
    class ImageDelete: public xmlrpc_c::method
1525
    {
1526
    public:
1527
        ImageDelete(ImagePool * _ipool,
1528
                      UserPool * _upool):
1529
                            ipool(_ipool),
1530
                            upool(_upool)
1531
        {
1532
            _signature="A:si";
1533
            _help="Deletes an image";
1534
        };
1535

  
1536
        ~ImageDelete(){};
1537

  
1538
        void execute(
1539
            xmlrpc_c::paramList const& paramList,
1540
            xmlrpc_c::value *   const  retvalP);
1541

  
1542
    private:
1543
        ImagePool * ipool;
1544
        UserPool  * upool;
1545
    };
1546

  
1547
    /* ---------------------------------------------------------------------- */
1548

  
1549
    class ImageInfo: public xmlrpc_c::method
1550
    {
1551
    public:
1552
        ImageInfo(ImagePool * _ipool,
1553
                  UserPool  * _upool):
1554
                      ipool(_ipool),
1555
                      upool(_upool)
1556
        {
1557
            _signature="A:si";
1558
            _help="Returns information for an image";
1559
        };
1560

  
1561
        ~ImageInfo(){};
1562

  
1563
        void execute(
1564
            xmlrpc_c::paramList const& paramList,
1565
            xmlrpc_c::value *   const  retvalP);
1566

  
1567
    private:
1568
        ImagePool * ipool;
1569
        UserPool  * upool;
1570
    };
1571

  
1572
    /* ---------------------------------------------------------------------- */
1573

  
1574
    class ImageUpdate: public xmlrpc_c::method
1575
    {
1576
    public:
1577
        ImageUpdate(ImagePool * _ipool,
1578
                    UserPool  * _upool):
1579
                        ipool(_ipool),
1580
                        upool(_upool)
1581
        {
1582
            _signature="A:siss";
1583
            _help="Modifies image attribute";
1584
        };
1585

  
1586
        ~ImageUpdate(){};
1587

  
1588
        void execute(
1589
            xmlrpc_c::paramList const& paramList,
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff