Statistics
| Branch: | Tag: | Revision:

one / include / VirtualMachineDisk.h @ 0fa579fd

History | View | Annotate | Download (23.5 KB)

1
/* -------------------------------------------------------------------------- */
2
/* Copyright 2002-2017, OpenNebula Project, OpenNebula Systems                */
3
/*                                                                            */
4
/* Licensed under the Apache License, Version 2.0 (the "License"); you may    */
5
/* not use this file except in compliance with the License. You may obtain    */
6
/* a copy of the License at                                                   */
7
/*                                                                            */
8
/* http://www.apache.org/licenses/LICENSE-2.0                                 */
9
/*                                                                            */
10
/* Unless required by applicable law or agreed to in writing, software        */
11
/* distributed under the License is distributed on an "AS IS" BASIS,          */
12
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   */
13
/* See the License for the specific language governing permissions and        */
14
/* limitations under the License.                                             */
15
/* -------------------------------------------------------------------------- */
16

    
17
#ifndef VIRTUAL_MACHINE_DISK_H_
18
#define VIRTUAL_MACHINE_DISK_H_
19

    
20
#include <queue>
21
#include <set>
22

    
23
#include "VirtualMachineAttribute.h"
24
#include "Snapshots.h"
25

    
26
class AuthRequest;
27

    
28
/**
29
 * The VirtualMachine DISK attribute
30
 */
31
class VirtualMachineDisk : public VirtualMachineAttribute
32
{
33
public:
34
    VirtualMachineDisk(VectorAttribute *va, int id):
35
        VirtualMachineAttribute(va, id), snapshots(0){};
36

    
37
    virtual ~VirtualMachineDisk()
38
    {
39
        delete snapshots;
40
    };
41

    
42
    /* ---------------------------------------------------------------------- */
43
    /* DISK get/set functions for boolean disk flags                          */
44
    /*   ATTACH                                                               */
45
    /*   RESIZE                                                               */
46
    /*   CLONING                                                              */
47
    /*   PERSISTENT                                                           */
48
    /*   DISK_SNAPSHOT_ACTIVE                                                 */
49
    /* ---------------------------------------------------------------------- */
50
    bool is_persistent() const
51
    {
52
        return is_flag("PERSISTENT");
53
    }
54

    
55
    bool is_managed() const
56
    {
57
        bool one_managed;
58

    
59
        if (vector_value("OPENNEBULA_MANAGED", one_managed) == -1)
60
        {
61
            one_managed = true;
62
        }
63

    
64
        return one_managed;
65
    }
66

    
67
    void set_attach()
68
    {
69
        set_flag("ATTACH");
70
    };
71

    
72
    void set_resize()
73
    {
74
        set_flag("RESIZE");
75
    };
76

    
77
    void clear_resize()
78
    {
79
        clear_flag("RESIZE");
80
    };
81

    
82
    void clear_cloning()
83
    {
84
        clear_flag("CLONING");
85
    };
86

    
87
    bool is_cloning() const
88
    {
89
        return is_flag("CLONING");
90
    }
91

    
92
    void set_active_snapshot()
93
    {
94
        set_flag("DISK_SNAPSHOT_ACTIVE");
95
    };
96

    
97
    void clear_active_snapshot()
98
    {
99
        clear_flag("DISK_SNAPSHOT_ACTIVE");
100
    };
101

    
102
    bool is_active_snapshot()
103
    {
104
        return is_flag("DISK_SNAPSHOT_ACTIVE");
105
    }
106

    
107
    void set_saveas()
108
    {
109
        set_flag("HOTPLUG_SAVE_AS_ACTIVE");
110
    };
111

    
112
    void clear_saveas()
113
    {
114
        clear_flag("HOTPLUG_SAVE_AS_ACTIVE");
115
    };
116

    
117
    /* ---------------------------------------------------------------------- */
118
    /* Disk attributes, not accesible through vector_value                    */
119
    /* ---------------------------------------------------------------------- */
120
    /**
121
     *  Return the disk id ("DISK_ID")
122
     */
123
    int get_disk_id() const
124
    {
125
        return get_id();
126
    }
127

    
128
    /**
129
     *  Return the "effective" target (LN_TARGET/CLONE_TARGET)
130
     */
131
    string get_tm_target() const;
132

    
133
    /**
134
     *  Check if the given disk is volatile
135
     */
136
    bool is_volatile() const;
137

    
138
    /**
139
     *  Get the effective uid to get an image. Used in VM parsers
140
     */
141
    int get_uid(int _uid);
142

    
143
    /**
144
     *  Gets the ID of the image associated to the disks
145
     *    @param id the image id, if found
146
     *    @param uid effective user id making the call
147
     *    @return 0 if the disk uses an image, -1 otherwise
148
     */
149
    int get_image_id(int &id, int uid);
150

    
151
    /* ---------------------------------------------------------------------- */
152
    /* Image Manager Interface                                                */
153
    /* ---------------------------------------------------------------------- */
154
    /**
155
     *  Fills the disk extended information attributes
156
     */
157
    void extended_info(int uid);
158

    
159
    /**
160
     *  Fills the authorization request for this disk based on its Image use
161
     *  requirements
162
     *    @param uid of user making the request
163
     *    @param ar auth request
164
     */
165
    void authorize(int uid, AuthRequest* ar);
166

    
167
    /* ---------------------------------------------------------------------- */
168
    /* Snapshots Interface                                                    */
169
    /* ---------------------------------------------------------------------- */
170
    /**
171
     *  Set the snapshots for this disks
172
     */
173
    void set_snapshots(Snapshots * _snapshots)
174
    {
175
        snapshots = _snapshots;
176
    };
177

    
178
    /**
179
     *  Return the snapshots of this disk
180
     */
181
    const Snapshots * get_snapshots() const
182
    {
183
        return snapshots;
184
    }
185

    
186
    /**
187
     *  Clear snapshots from the disk and free resources
188
     */
189
    void clear_snapshots()
190
    {
191
        if ( snapshots == 0 )
192
        {
193
            return;
194
        }
195

    
196
        snapshots->clear();
197

    
198
        delete snapshots;
199

    
200
        snapshots = 0;
201
    }
202

    
203
    /**
204
     *  @return total snapshot size (virtual) in mb
205
     */
206
    long long get_total_snapshot_size() const
207
    {
208
        if ( snapshots == 0 )
209
        {
210
            return 0;
211
        }
212

    
213
        return snapshots->get_total_size();
214
    }
215

    
216
    /**
217
     *  Get the size (virtual) in mb of the given snapshot
218
     *    @param id of the snapshot
219
     *    @return size or 0 if not found
220
     */
221
    long long get_snapshot_size(int snap_id) const
222
    {
223
        if ( snapshots == 0 )
224
        {
225
            return 0;
226
        }
227

    
228
        return snapshots->get_snapshot_size(snap_id);
229
    }
230

    
231
    /**
232
     *  @return true if the disk has snapshots
233
     */
234
    bool has_snapshots()
235
    {
236
        return (snapshots != 0);
237
    }
238

    
239
    /**
240
     *  Creates a new snapshot of the disk
241
     *    @param name a description for this snapshot
242
     *    @param error if any
243
     *    @return the id of the new snapshot or -1 if error
244
     */
245
    int create_snapshot(const string& name, string& error);
246

    
247
    /**
248
     *  Sets the snap_id as active, the VM will boot from it next time
249
     *    @param snap_id of the snapshot
250
     *    @return -1 if error
251
     */
252
    int revert_snapshot(int snap_id);
253

    
254
    /**
255
     *  Deletes the snap_id from the list
256
     *    @param snap_id of the snapshot
257
     *    @param ds_quotas template with snapshot usage for the DS quotas
258
     *    @param vm_quotas template with snapshot usage for the VM quotas
259
     *    @param io delete ds quotas from image owners
260
     *    @param vo delete ds quotas from vm owners
261
     */
262
    void delete_snapshot(int snap_id, Template **ds_quota, Template **vm_quota,
263
            bool& io, bool& vo);
264

    
265
    /* ---------------------------------------------------------------------- */
266
    /* Disk resize functions                                                  */
267
    /* ---------------------------------------------------------------------- */
268
    /**
269
     *  Cleans the resize attribute from the disk
270
     *    @param restore the previous size
271
     */
272
    void clear_resize(bool restore);
273

    
274
    /**
275
     *  Calculate the quotas for a resize operation on the disk
276
     *    @param new_size of disk
277
     *    @param dsdeltas increment in datastore usage
278
     *    @param vmdelta increment in system datastore usage
279
     *    @param do_img_owner quotas counter allocated for image uid/gid
280
     *    @param do_vm_owner quotas counter allocated for vm uid/gid
281
     *
282
     */
283
   void resize_quotas(long long new_size, Template& dsdelta, Template& vmdelta,
284
           bool& do_img_owner, bool& do_vm_owner);
285

    
286
    /* ---------------------------------------------------------------------- */
287
    /* Disk space usage functions                                             */
288
    /* ---------------------------------------------------------------------- */
289

    
290
    /**
291
     *  @return the space required by this disk in the system datastore
292
     */
293
    long long system_ds_size();
294

    
295
    /**
296
     *  @return the space required by this disk in the image datastore
297
     */
298
    long long image_ds_size();
299

    
300
    /**
301
     *  Compute the storage needed by the disk in the system and/or image
302
     *  datastore
303
     *    @param ds_id of the datastore
304
     *    @param img_sz size in image datastore needed
305
     *    @param sys_sz size in system datastore needed
306
     */
307
    void datastore_sizes(int& ds_id, long long& img_sz, long long& sys_sz);
308

    
309
private:
310

    
311
    Snapshots * snapshots;
312
};
313

    
314

    
315
/**
316
 *  Set of VirtualMachine DIKS
317
 */
318
class VirtualMachineDisks : public VirtualMachineAttributeSet
319
{
320
public:
321
    /* ---------------------------------------------------------------------- */
322
    /* Constructor and Initialization functions                               */
323
    /* ---------------------------------------------------------------------- */
324
    /**
325
     *  Creates the VirtualMachineDisk set from a Template with DISK=[...]
326
     *  attributes, in this case the id's of each disk is auto assigned
327
     *    @param tmpl template with DISK
328
     */
329
    VirtualMachineDisks(Template * tmpl, bool has_id):
330
        VirtualMachineAttributeSet(false)
331
    {
332
        std::vector<VectorAttribute *> vas;
333

    
334
        tmpl->get(DISK_NAME, vas);
335

    
336
        init(vas, has_id);
337
    };
338

    
339
    /**
340
     *  Creates the VirtualMachineDisk set from a vector of DISK VectorAttribute
341
     *  The DIKS need to have a DISK_ID assgined to create the disk set.
342
     *    @param va vector of DISK Vector Attributes
343
     */
344
    VirtualMachineDisks(vector<VectorAttribute *>& va, bool has_id, bool dispose):
345
        VirtualMachineAttributeSet(dispose)
346
    {
347
        init(va, has_id);
348
    };
349

    
350
    /**
351
     *  Creates an empty disk set
352
     */
353
    VirtualMachineDisks(bool dispose):
354
        VirtualMachineAttributeSet(dispose){};
355

    
356
    virtual ~VirtualMachineDisks(){};
357

    
358
    /**
359
     *  Function used to initialize the attribute map based on a vector of DISK
360
     */
361
    void init(std::vector<VectorAttribute *>& vas, bool has_id)
362
    {
363
        if ( has_id )
364
        {
365
            init_attribute_map(DISK_ID_NAME, vas);
366
        }
367
        else
368
        {
369
            init_attribute_map("", vas);
370
        }
371
    }
372

    
373
    /* ---------------------------------------------------------------------- */
374
    /* Iterators                                                              */
375
    /* ---------------------------------------------------------------------- */
376
    /**
377
     *  Generic iterator for the disk set.
378
     */
379
    class DiskIterator : public AttributeIterator
380
    {
381
    public:
382
        DiskIterator():AttributeIterator(){};
383
        DiskIterator(const AttributeIterator& dit):AttributeIterator(dit){};
384
        virtual ~DiskIterator(){};
385

    
386
        VirtualMachineDisk * operator*() const
387
        {
388
            return static_cast<VirtualMachineDisk *>(map_it->second);
389
        }
390
    };
391

    
392
    DiskIterator begin()
393
    {
394
        DiskIterator it(ExtendedAttributeSet::begin());
395
        return it;
396
    }
397

    
398
    DiskIterator end()
399
    {
400
        DiskIterator it(ExtendedAttributeSet::end());
401
        return it;
402
    }
403

    
404
    typedef class DiskIterator disk_iterator;
405

    
406
    /* ---------------------------------------------------------------------- */
407
    /* DISK interface                                                         */
408
    /* ---------------------------------------------------------------------- */
409
    /**
410
     * Returns the DISK attribute for a disk
411
     *   @param disk_id of the DISK
412
     *   @return pointer to the attribute ir null if not found
413
     */
414
    VirtualMachineDisk * get_disk(int disk_id) const
415
    {
416
        return static_cast<VirtualMachineDisk*>(get_attribute(disk_id));
417
    }
418

    
419
    /**
420
     *  Computes the storage needed in the system datastore. The static version
421
     *  uses the disk definitions in the template (first argument)
422
     *    @return the total disk SIZE that the VM instance needs in the system DS
423
     */
424
    long long system_ds_size();
425

    
426
    static long long system_ds_size(Template * ds_tmpl);
427

    
428
    /**
429
     *  Completes the information of the disks (IMAGE_ID, SIZE...)
430
     */
431
    void extended_info(int uid);
432

    
433
    static void extended_info(int uid, Template * tmpl);
434

    
435
    /**
436
     *  Computes the storage in the image DS needed for the disks in a VM
437
     *  template
438
     *    @param tmpl with DISK descriptions
439
     *    @param ds_quotas templates for quota updates
440
     */
441
    static void image_ds_quotas(Template * tmpl, vector<Template *>& ds_quotas);
442

    
443
    /**
444
     *  Sets Datastore information on volatile disks
445
     */
446
    bool volatile_info(int ds_id);
447

    
448
    /**
449
     *  @return the total disk SIZE that the VM instance needs in the system DS
450
     */
451
    void image_ds_size(std::map<int, long long>& ds_size) const;
452

    
453
    /**
454
     *  Gets the IDs of the images associated to the disk set
455
     *    @param ids set of image ids
456
     *    @param uid effective user id making the call
457
     */
458
    void get_image_ids(set<int>& ids, int uid);
459

    
460
    /* ---------------------------------------------------------------------- */
461
    /* Image Manager Interface                                                */
462
    /* ---------------------------------------------------------------------- */
463
    /**
464
     *  Get all disk images for this Virtual Machine
465
     *  @param vm_id of the VirtualMachine
466
     *  @param uid of owner
467
     *  @param disks list of DISK Attribute in VirtualMachine Template
468
     *  @param context attribute, 0 if none
469
     *  @param error_str Returns the error reason, if any
470
     *  @return 0 if success
471
     */
472
    int get_images(int vm_id, int uid, vector<Attribute *> disks,
473
            VectorAttribute * context, std::string& error_str);
474

    
475
    /**
476
     *  Release the images in the disk set
477
     *    @param vmid id of VM
478
     *    @param img_error true if the image has to be set in error state
479
     *    @param quotas disk space usage to free from image datastores
480
     */
481
    void release_images(int vmid, bool img_error, vector<Template *>& quotas);
482

    
483
    /* ---------------------------------------------------------------------- */
484
    /* DISK cloning functions                                                 */
485
    /* ---------------------------------------------------------------------- */
486
    /**
487
     * Returns true if any of the disks is waiting for an image in LOCKED state
488
     * to become READY
489
     *   @return true if cloning
490
     */
491
    bool has_cloning();
492

    
493
    /**
494
     * Returns the image IDs for the disks waiting for the LOCKED state be READY
495
     *   @param ids image ID set
496
     */
497
    void get_cloning_image_ids(std::set<int>& ids);
498

    
499
    /**
500
     * Clears the flag for the disks waiting for the given image
501
     */
502
    void clear_cloning_image_id(int image_id, const string& source);
503

    
504
    /* ---------------------------------------------------------------------- */
505
    /* Attach disk Interface                                                  */
506
    /* ---------------------------------------------------------------------- */
507
    /**
508
     *  Clear attach status from the attach disk (ATTACH=YES)
509
     */
510
    VirtualMachineDisk * delete_attach()
511
    {
512
        return static_cast<VirtualMachineDisk *>(remove_attribute("ATTACH"));
513
    }
514

    
515
    /**
516
     *  Get the attach disk (ATTACH=YES)
517
     */
518
    VirtualMachineDisk * get_attach()
519
    {
520
        return static_cast<VirtualMachineDisk *>(get_attribute("ATTACH"));
521
    }
522

    
523
    /**
524
     *  Sets the attach attribute to the given disk
525
     *    @param disk_id of the DISK
526
     *    @return 0 if the disk_id was found -1 otherwise
527
     */
528
    int set_attach(int disk_id);
529

    
530
    /**
531
     *  Cleans the attach attribute from the disk
532
     */
533
    void clear_attach()
534
    {
535
        clear_flag("ATTACH");
536
    }
537

    
538
    /**
539
     *  Prepares a disk to be attached to the virtual machine and adds it to the
540
     *  disk set. It checks target assigment and cluster compatibility.
541
     *     @param vmid id of virtual machine
542
     *     @param uid of VM owner
543
     *     @param cluster_id where the VM is running
544
     *     @param vdisk VectorAttribute for the new disk
545
     *     @param vcontext VectorAttribute for the CONTEXT disk, 0 if none
546
     *     @param error
547
     *
548
     *     @return Pointer to the new disk or 0 in case of error
549
     */
550
    VirtualMachineDisk * set_up_attach(int vmid, int uid, int cluster_id,
551
            VectorAttribute * vdisk, VectorAttribute * vcontext, string& error);
552

    
553
    /* ---------------------------------------------------------------------- */
554
    /* Save as Interface                                                      */
555
    /* ---------------------------------------------------------------------- */
556
    /**
557
     *  Get the saveas disk (HOTPLUG_SAVE_AS_ACTIVE = YES)
558
     */
559
    VirtualMachineDisk * get_saveas()
560
    {
561
        return static_cast<VirtualMachineDisk *>(
562
                get_attribute("HOTPLUG_SAVE_AS_ACTIVE"));
563
    }
564

    
565
    /**
566
     *  Mark the disk that is going to be "save as"
567
     *    @param disk_id of the VM
568
     *    @param snap_id of the disk to save, -1 to select the active snapshot
569
     *    @param iid The image id used by the disk
570
     *    @param size The disk size. This may be different to the original
571
     *    image size
572
     *    @param err_str describing the error if any
573
     *    @return -1 if the image cannot saveas, 0 on success
574
     */
575
    int set_saveas(int disk_id, int snap_id, int &iid, long long &size,
576
            string& err_str);
577

    
578
    /**
579
     *  Set save attributes for the disk
580
     *    @param  disk_id Index of the disk to save
581
     *    @param  source to save the disk
582
     *    @param  img_id ID of the image this disk will be saved to
583
     */
584
    int set_saveas(int disk_id, const string& source, int iid);
585

    
586
    /**
587
     * Clears the SAVE_AS_* attributes of the disk being saved as
588
     *    @return the ID of the image this disk will be saved to or -1 if it
589
     *    is not found.
590
     */
591
    int clear_saveas();
592

    
593
    /**
594
     * Get the original image id of the disk. It also checks that the disk can
595
     * be saved_as.
596
     *    @param  disk_id Index of the disk to save
597
     *    @param  source of the image to save the disk to
598
     *    @param  image_id of the image to save the disk to
599
     *    @param  tm_mad in use by the disk
600
     *    @param  ds_id of the datastore in use by the disk
601
     *    @return -1 if failure
602
     */
603
    int get_saveas_info(int& disk_id, string& source, int& image_id,
604
            string& snap_id, string& tm_mad, string& ds_id);
605

    
606
    /* ---------------------------------------------------------------------- */
607
    /* Resize disk Interface                                                  */
608
    /* ---------------------------------------------------------------------- */
609
    VirtualMachineDisk * get_resize()
610
    {
611
        return static_cast<VirtualMachineDisk *>(get_attribute("RESIZE"));
612
    }
613

    
614
    VirtualMachineDisk * delete_resize()
615
    {
616
        return static_cast<VirtualMachineDisk *>(remove_attribute("RESIZE"));
617
    }
618

    
619
    /**
620
     *  Sets the resize attribute to the given disk
621
     *    @param disk_id of the DISK
622
     *    @return 0 if the disk_id was found -1 otherwise
623
     */
624
    int set_resize(int disk_id);
625

    
626
    /**
627
     *  Prepares a disk to be resized.
628
     *     @param disk_id of disk
629
     *     @param size new size for the disk (needs to be greater than current)
630
     *     @param error
631
     *
632
     *     @return 0 on success
633
     */
634
        int set_up_resize(int disk_id, long size, string& error);
635

    
636
    /* ---------------------------------------------------------------------- */
637
    /* SNAPSHOT interface                                                     */
638
    /* ---------------------------------------------------------------------- */
639
    VirtualMachineDisk * get_active_snapshot()
640
    {
641
        return static_cast<VirtualMachineDisk *>(
642
                get_attribute("DISK_SNAPSHOT_ACTIVE"));
643
    }
644

    
645
    /**
646
     *  Set the snapshots for a disk
647
     *    @param id of disk
648
     *    @param snapshots of disk;
649
     */
650
    void set_snapshots(int id, Snapshots * snapshots);
651

    
652
    /**
653
     *  Return the snapshots for the disk
654
     */
655
    const Snapshots * get_snapshots(int id, string& error) const;
656

    
657
    /**
658
     *  Set the disk as being snapshotted (reverted...)
659
     *    @param disk_id of the disk
660
     *    @param snap_id of the target snap_id
661
     */
662
    int set_active_snapshot(int id, int snap_id);
663

    
664
    /**
665
     *  Unset the current disk being snapshotted (reverted...)
666
     */
667
    void clear_active_snapshot();
668

    
669
    /**
670
     *  Get information about the disk to take the snapshot from
671
     *    @param ds_id id of the datastore
672
     *    @param tm_mad used by the datastore
673
     *    @param disk_id of the disk
674
     *    @param snap_id of the snapshot
675
     */
676
    int get_active_snapshot(int& ds_id, string& tm_mad, int& disk_id,
677
            int& snap_id);
678
    /**
679
     *  Creates a new snapshot of the given disk
680
     *    @param disk_id of the disk
681
     *    @param name a description for this snapshot
682
     *    @param error if any
683
     *    @return the id of the new snapshot or -1 if error
684
     */
685
    int create_snapshot(int disk_id, const string& name, string& error);
686

    
687
    /**
688
     *  Sets the snap_id as active, the VM will boot from it next time
689
     *    @param disk_id of the disk
690
     *    @param snap_id of the snapshot
691
     *    @return -1 if error
692
     */
693
    int revert_snapshot(int disk_id, int snap_id);
694

    
695
    /**
696
     *  Deletes the snap_id from the list
697
     *    @param disk_id of the disk
698
     *    @param snap_id of the snapshot
699
     *    @param ds_quotas template with snapshot usage for the DS quotas
700
     *    @param vm_quotas template with snapshot usage for the VM quotas
701
     *    @param io delete ds quotas from image owners
702
     *    @param vo delete ds quotas from vm owners
703
     */
704
    void delete_snapshot(int disk_id, int snap_id, Template **ds_quota,
705
            Template **vm_quota, bool& io, bool& vo);
706

    
707
    /**
708
     * Deletes all the disk snapshots for non-persistent disks and for persistent
709
     * disks in no shared system ds.
710
     *     @param vm_quotas The SYSTEM_DISK_SIZE freed by the deleted snapshots
711
     *     @param ds_quotas The DS SIZE freed from image datastores.
712
     */
713
    void delete_non_persistent_snapshots(Template **vm_quotas,
714
        vector<Template *> &ds_quotas);
715

    
716
    /**
717
     * Restores the disk original size for non-persistent and for persistent
718
     * disks in no shared system ds.
719
     *     @param vm_quotas The SYSTEM_DISK_SIZE freed by the deleted snapshots
720
     *     @param ds_quotas The DS SIZE freed from image datastores.
721
     */
722
    void delete_non_persistent_resizes(Template **vm_quotas,
723
        vector<Template *> &ds_quotas);
724

    
725
protected:
726

    
727
    VirtualMachineAttribute * attribute_factory(VectorAttribute * va,
728
        int id) const
729
    {
730
        return new VirtualMachineDisk(va, id);
731
    };
732

    
733
private:
734

    
735
    static const char * DISK_NAME; //"DISK"
736

    
737
    static const char * DISK_ID_NAME; //"DISK_ID"
738

    
739
    /**
740
     *   Finds the first free target to assign to a disk
741
     *     @param dqueue queue of disks to assign target, each disk is associated
742
     *     with its bus (DEV_PREFIX)
743
     *     @param used_targets that cannot be used
744
     */
745
    void assign_disk_targets(
746
            std::queue<pair <std::string, VirtualMachineDisk *> >& dqueue,
747
            std::set<std::string>& used_targets);
748
};
749

    
750
#endif  /*VIRTUAL_MACHINE_DISK_H_*/
751