You are here: Home / Projects / EVE / eveadm / domainmgr vs vmadm

domainmgr vs vmadm

by Mikhail Kompaniets last modified Jan 21, 2020 09:04 PM

this text is related to file domainmgr.go

low level functions:

function

xl/rkt commandused in
rktRun(domainName, ContainerImageID, xenCfgFilename, imageHash string) (int, string, error) cmd := "rkt"
    args := []string{
        "--dir=" + types.PersistRktDataDir,
        "--insecure-options=image",
        "run",
        imageHash,
        "--stage1-path=/usr/sbin/stage1-xen.aci",
        "--uuid-file-save=" + uuidFile,
    }
    stage1XlOpts := "STAGE1_XL_OPTS=-p"
stage1XlCfg := "STAGE1_SEED_XL_CFG=" + xenCfgFilename
DomainCreate

rktStatus(podUUID string) string

  cmd := "rkt"
    args := []string{
        "--dir=" + types.PersistRktDataDir,
        "status",
        podUUID,
        "--format=json",
}

rktRun
xlCreate(domainName string, xenCfgFilename string) (int, error)     cmd := "xl"
    args := []string{
        "create",
        xenCfgFilename,
        "-p",
}

DomainCreate
 xlStatus(domainName string, domainID int) error  cmd := "xl"
    args := []string{
        "list",
        "-l",
        domainName,
}

doActiavteTail

waitForDomainGone

handleDelete

xlDomid(domainName string, domainID int) (int, error)

    cmd := "xl"
    args := []string{
        "domid",
        domainName,
}

verifyStatus

doActiavteTail

doInactivate

xlDisableVifOffload(domainName string, domainID int, vifCount int) error

// Perform xenstore write to disable all of these for all VIFs
// feature-sg, feature-gso-tcpv4, feature-gso-tcpv6, feature-ipv6-csum-offload

pref := "/local/domain"
    for i := 0; i < vifCount; i += 1 {
        varNames := []string{
            fmt.Sprintf("%s/0/backend/vif/%d/%d/feature-sg",
                pref, domainID, i),
 …..
       for _, varName := range varNames {
            cmd := "xenstore"
            args := []string{
                "write",
                varName,
                "0",
}

doActivateTail
xlUnpause(domainName string, domainID int) error cmd := "xl"
    args := []string{
        "unpause",
        domainName,
}

doActivateTail

 

rktStop(PodUUID string, force bool) error cmd := "rkt"
    var args []string
    if force {
        // rkt --dir=<RKT_DATA_DIR> stop PodUUID --force=true
        args = []string{
            "--dir=" + types.PersistRktDataDir,
            "stop",
            PodUUID,
            "--force=true",
        }
    } else {
        // rkt --dir=<RKT_DATA_DIR> stop PodUUID
        args = []string{
            "--dir=" + types.PersistRktDataDir,
            "stop",
            PodUUID,
        }

DomainShutdown

doStopDestroyDomain

xlShutdown(domainName string, domainID int, force bool) error  cmd := "xl"
    var args []string
    if force {
        args = []string{
            "shutdown",
            "-F",
            domainName,
        }
    } else {
        args = []string{
            "shutdown",
            domainName,
        }

DomainShutdown
rktRm(PodUUID string) error // rkt --dir=<RKT_DATA_DIR> rm PodUUID
    cmd := "rkt"
    args := []string{
        "--dir=" + types.PersistRktDataDir,
        "rm",
        PodUUID,
    }

DomainDestroy

handleDelete

xlDestroy(domainName string, domainID int) error    cmd := "xl"
    args := []string{
        "destroy",
        domainName,
    }

DomainDestroy
isQemuRunning(domid int) bool {
  
 // create pgrep command to see if dataplane is running
    match := fmt.Sprintf("domid %d", domid)
cmd := wrap.Command("pgrep", "-f", match)
verifyStatus
func pciAssignableAdd(long string) error {
  
    cmd := "xl"
    args := []string{
        "pci-assignable-add",
        long,
}
func pciAssignableRemove(long string) error {     cmd := "xl"
    args := []string{
        "pci-assignable-rem",
        "-r",
        long,
}

 

functioncallsvmadmcomments

// doStopDestroyDomain will destroy the domain of an instance if qemu is crashed
doStopDestroyDomain

rktStop

DomainDestroy

vmadm delete {uuid}
// Check if it is still running
// XXX would xen state be useful?
verifyStatus
xlDomid
publishDomainStatus
isQemuRunning
doStopDestroyDomain

vmadm get {uuid}

(field "state")

 

func doActivate(ctx *domainContext, config types.DomainConfig,
status *types.DomainStatus) {
DomainCreate
publishDomainStatus
doActivateTail

vmadm create

 

doActivateTail(ctx *domainContext, status *types.DomainStatus,
domainID int)
publishDomainStatus
xlDisableVifOffload
xlUnpause
xlDomid

vmadm create ??

vmadm run??

 Разобраться зачем создание ВМ разделено на две части.

// shutdown and wait for the domain to go away; if that fails destroy and wait
doInactivate(ctx *domainContext, status *types.DomainStatus)
xlDomid
publishDomainStatus
DomainShutdown
waitForDomainGone
DomainDestroy
delImageStatus
pciUnassign
vmadm stop {uuid}
// Used to wait both after shutdown and destroy
func waitForDomainGone(status types.DomainStatus, maxDelay time.Duration) bool
xlStatus

vmadm get {uuid}

field status

 

func handleDelete(ctx *domainContext, key string, status *types.DomainStatus)

doInactivate
rktRm
...

vmadm delete {uuid}

чем отличается от destroy?
// DomainCreate is a wrapper for domain creation thru xlCreate or rktRun
// returns domainID, PodUUID and error
func DomainCreate(status types.DomainStatus) (int, string, error)

rktRun
xlCreate
...

vmadm create

как в vmadm создать машину в состоянии paused?

// DomainShutdown is a wrapper for domain shutdown thru xlShutdown or rktStop
func DomainShutdown(status types.DomainStatus, force bool) error
rktStop
xlShutdown
vmadm stop {uuid}
// DomainDestroy is a wrapper for domain Destroy thru xlDestroy or rktRm
func DomainDestroy(status types.DomainStatus) error
rktRm
xlDestroy
vmadm delete {uuid}
handleModify vmadm update??
vmadm list
vmadm console