VirtualBox

Changeset 35040 in vbox for trunk


Ignore:
Timestamp:
Dec 13, 2010 5:44:28 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
68870
Message:

Main/Medium+Machine+Settings: new medium type MultiAttach, meant for having many VMs pointing at the same base medium and each having its own diff for changes

Location:
trunk/src/VBox/Main
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MachineImpl.cpp

    r35009 r35040  
    75467546                }
    75477547
     7548                if (medium->getType() == MediumType_MultiAttach)
     7549                {
     7550                    if (isSnapshotMachine())
     7551                        return setError(E_FAIL,
     7552                                        tr("Multi-attach hard disk '%s' with UUID {%RTuuid} cannot be directly attached to snapshot with UUID {%RTuuid} "
     7553                                           "of the virtual machine '%s' ('%s')"),
     7554                                        medium->getLocationFull().c_str(),
     7555                                        dev.uuid.raw(),
     7556                                        puuidSnapshot->raw(),
     7557                                        mUserData->s.strName.c_str(),
     7558                                        mData->m_strConfigFileFull.c_str());
     7559
     7560                    return setError(E_FAIL,
     7561                                    tr("Multi-attach hard disk '%s' with UUID {%RTuuid} cannot be directly attached to the virtual machine '%s' ('%s')"),
     7562                                    medium->getLocationFull().c_str(),
     7563                                    dev.uuid.raw(),
     7564                                    mUserData->s.strName.c_str(),
     7565                                    mData->m_strConfigFileFull.c_str());
     7566                }
     7567
    75487568                if (    !isSnapshotMachine()
    75497569                     && medium->getChildren().size() != 0
  • trunk/src/VBox/Main/MediumImpl.cpp

    r35009 r35040  
    16461646
    16471647    /* Cannot change the type of a medium being in use by more than one VM.
    1648      * If the change is to Immutable then it must not be attached to any VM,
    1649      * otherwise assumptions elsewhere are violated and the VM becomes
    1650      * inaccessible. Attaching an immutable medium triggers the diff creation,
    1651      * and this is vital for the correct operation. */
     1648     * If the change is to Immutable or MultiAttach then it must not be
     1649     * directly attached to any VM, otherwise the assumptions about indirect
     1650     * attachment elsewhere are violated and the VM becomes inaccessible.
     1651     * Attaching an immutable medium triggers the diff creation, and this is
     1652     * vital for the correct operation. */
    16521653    if (   m->backRefs.size() > 1
    1653         || (aType == MediumType_Immutable && m->backRefs.size() > 0))
     1654        || (   (   aType == MediumType_Immutable
     1655                || aType == MediumType_MultiAttach)
     1656            && m->backRefs.size() > 0))
    16541657        return setError(VBOX_E_INVALID_OBJECT_STATE,
    16551658                        tr("Cannot change the type of medium '%s' because it is attached to %d virtual machines"),
     
    16601663        case MediumType_Normal:
    16611664        case MediumType_Immutable:
     1665        case MediumType_MultiAttach:
    16621666        {
    16631667            /* normal can be easily converted to immutable and vice versa even
     
    34233427        }
    34243428        case MediumType_Immutable:
     3429        case MediumType_MultiAttach:
    34253430            return true;
    34263431        case MediumType_Writethrough:
     
    42374242                               tr("Medium '%s' is immutable"),
    42384243                               m->strLocationFull.c_str());
     4244            if (m->type == MediumType_MultiAttach)
     4245                throw setError(VBOX_E_INVALID_OBJECT_STATE,
     4246                               tr("Medium '%s' is multi-attach"),
     4247                               m->strLocationFull.c_str());
    42394248        }
    42404249        else
     
    42514260                throw setError(VBOX_E_INVALID_OBJECT_STATE,
    42524261                               tr("Medium '%s' is immutable"),
     4262                               pTarget->m->strLocationFull.c_str());
     4263            if (pTarget->m->type == MediumType_MultiAttach)
     4264                throw setError(VBOX_E_INVALID_OBJECT_STATE,
     4265                               tr("Medium '%s' is multi-attach"),
    42534266                               pTarget->m->strLocationFull.c_str());
    42544267        }
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r34907 r35040  
    87938793  <enum
    87948794    name="MediumType"
    8795     uuid="19388a99-8e70-4bd4-9a95-90cbc513ef6d"
     8795    uuid="fe663fb5-c244-4e1b-9d81-c628b417dd04"
    87968796    >
    87978797    <desc>
     
    88278827      <desc>
    88288828        A readonly medium, which can of course be used by several machines.
     8829        <note>Present and accepted since VirtualBox 4.0.</note>
     8830      </desc>
     8831    </const>
     8832    <const name="MultiAttach"       value="5">
     8833      <desc>
     8834        A medium which is is indirectly attached, so that one base medium can
     8835        be used for several VMs which have their own differencing medium to
     8836        store their modifications. In some sense a variant of Immutable
     8837        with unset AutoReset flag in each differencing medium.
    88298838        <note>Present and accepted since VirtualBox 4.0.</note>
    88308839      </desc>
  • trunk/src/VBox/Main/xml/Settings.cpp

    r34837 r35040  
    678678            else if (strType == "READONLY")
    679679                med.hdType = MediumType_Readonly;
     680            else if (strType == "MULTIATTACH")
     681                med.hdType = MediumType_MultiAttach;
    680682            else
    681                 throw ConfigFileError(this, &elmMedium, N_("HardDisk/@type attribute must be one of Normal, Immutable or Writethrough"));
     683                throw ConfigFileError(this, &elmMedium, N_("HardDisk/@type attribute must be one of Normal, Immutable, Writethrough, Shareable, Readonly or MultiAttach"));
    682684        }
    683685    }
     
    10371039            mdm.hdType == MediumType_Writethrough ? "Writethrough" :
    10381040            mdm.hdType == MediumType_Shareable ? "Shareable" :
    1039             mdm.hdType == MediumType_Readonly ? "Readonly" : "INVALID";
     1041            mdm.hdType == MediumType_Readonly ? "Readonly" :
     1042            mdm.hdType == MediumType_MultiAttach ? "MultiAttach" :
     1043            "INVALID";
    10401044        pelmMedium->setAttribute("type", pcszType);
    10411045    }
     
    44824486    }
    44834487
     4488    // Settings version 1.11 is required if Readonly/MultiAttach media
     4489    // are present.
     4490    if (m->sv < SettingsVersion_v1_11)
     4491    {
     4492        /// @todo add code going over all medium attachments and check if
     4493        // they are of type Readonly or MultiAttach.
     4494    }
     4495
    44844496    // settings version 1.9 is required if there is not exactly one DVD
    44854497    // or more than one floppy drive present or the DVD is not at the secondary
  • trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd

    r34497 r35040  
    308308            <xsd:enumeration value="Immutable"/>
    309309            <xsd:enumeration value="Writethrough"/>
     310            <xsd:enumeration value="Shareable"/>
     311            <xsd:enumeration value="Readonly"/>
     312            <xsd:enumeration value="MultiAttach"/>
    310313          </xsd:restriction>
    311314        </xsd:simpleType>
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette