[pve-devel] [PATCH] Update to v2.3.0

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Jun 3 09:27:31 CEST 2015


keymap.diff: removing last hunk
It only removes spaces, upstream already did that when
adding an assertion to it.

pve-auth.diff & fairsched.diff:
 * dropped fairsched and moved vmid code to pve-auth.diff
 * adapt pve-auth.diff to new qemu option parsing

virtio-balloon-fix-query.patch:
 * merged ram_size -> get_current_ram_size() change

backup-modify-job-api.patch
 * move new bdrv_op_unblock(target) into target guard
 * fuzz/context fixup
 * added NULL target checks to new places where necessary
   (bdrv_op_is_blocked is now used on the target in
   backup_start)
 * annotated some hunks with their function
 * applied same backup_start fixup of qmp_drive_backup to
   the new qmp_blockdev_backup (introduced in c29c1dd3)

disable-efi-enable-pxe-roms.patch: fuzz/context fixup

virtio-balloon-dimmfix1.patch: is now upstream
virtio-balloon-dimmfix2.patch: is now upstream
virtio-balloon-dimmfix3.patch:
  merged into virtio-balloon-fix-query.patch
virtio-scsi_fix_assert.patch: is now upstream

backup-add-dir-format.patch,
backup-add-pve-monitor-commands.patch,
internal-snapshot-async.patch:
 * Convert bdrv_find to blk_by_name
   bdrv_find was dropped and the code now uses blk_by_name
   and blk_bs

internal-snapshot-async.patch:
 * fuzz/context fixups
 * added missing sysemu/block-backend.h for blk_by_name

(removed one unused patch that still uses bdrv_find:
0003-add-backup-related-monitor-commands.patch)
---
 .../0003-add-backup-related-monitor-commands.patch | 826 ---------------------
 debian/patches/backup-add-dir-format.patch         |   4 +-
 .../patches/backup-add-pve-monitor-commands.patch  |  10 +-
 debian/patches/backup-add-vma-binary.patch         |   4 +-
 debian/patches/backup-modify-job-api.patch         |  47 +-
 debian/patches/disable-efi-enable-pxe-roms.patch   |   8 +-
 debian/patches/fairsched.diff                      | 163 ----
 debian/patches/internal-snapshot-async.patch       |  59 +-
 debian/patches/keymap.diff                         |   9 -
 debian/patches/pve-auth.patch                      | 138 ++--
 debian/patches/series                              |   5 -
 debian/patches/virtio-balloon-dimmfix1.patch       |  93 ---
 debian/patches/virtio-balloon-dimmfix2.patch       |  93 ---
 debian/patches/virtio-balloon-dimmfix3.patch       |  27 -
 debian/patches/virtio-balloon-fix-query.patch      |  24 +-
 debian/patches/virtio-scsi_fix_assert.patch        |  45 --
 16 files changed, 183 insertions(+), 1372 deletions(-)
 delete mode 100644 debian/patches/0003-add-backup-related-monitor-commands.patch
 delete mode 100644 debian/patches/fairsched.diff
 delete mode 100644 debian/patches/virtio-balloon-dimmfix1.patch
 delete mode 100644 debian/patches/virtio-balloon-dimmfix2.patch
 delete mode 100644 debian/patches/virtio-balloon-dimmfix3.patch
 delete mode 100644 debian/patches/virtio-scsi_fix_assert.patch

diff --git a/debian/patches/0003-add-backup-related-monitor-commands.patch b/debian/patches/0003-add-backup-related-monitor-commands.patch
deleted file mode 100644
index 0a23a45..0000000
--- a/debian/patches/0003-add-backup-related-monitor-commands.patch
+++ /dev/null
@@ -1,826 +0,0 @@
-From cf9cc8878d3246069da3fdf7ec865b7b983487fe Mon Sep 17 00:00:00 2001
-From: Dietmar Maurer <dietmar at proxmox.com>
-Date: Tue, 13 Nov 2012 11:27:56 +0100
-Subject: [PATCH v5 3/6] add backup related monitor commands
-
-We use a generic BackupDriver struct to encapsulate all archive format
-related function.
-
-Another option would be to simply dump <devid,cluster_num,cluster_data> to
-the output fh (pipe), and an external binary saves the data. That way we
-could move the whole archive format related code out of qemu.
-
-Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
----
- backup.h         |   15 ++
- blockdev.c       |  423 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
- hmp-commands.hx  |   31 ++++
- hmp.c            |   63 ++++++++
- hmp.h            |    3 +
- monitor.c        |    7 +
- qapi-schema.json |   95 ++++++++++++
- qmp-commands.hx  |   27 ++++
- 8 files changed, 664 insertions(+), 0 deletions(-)
-
-diff --git a/backup.h b/backup.h
-index 9b1ea1c..22598a6 100644
---- a/backup.h
-+++ b/backup.h
-@@ -14,6 +14,9 @@
- #ifndef QEMU_BACKUP_H
- #define QEMU_BACKUP_H
- 
-+#include <uuid/uuid.h>
-+#include "block/block.h"
-+
- #define BACKUP_CLUSTER_BITS 16
- #define BACKUP_CLUSTER_SIZE (1<<BACKUP_CLUSTER_BITS)
- #define BACKUP_BLOCKS_PER_CLUSTER (BACKUP_CLUSTER_SIZE/BDRV_SECTOR_SIZE)
-@@ -27,4 +30,16 @@ int backup_job_create(BlockDriverState *bs, BackupDumpFunc *backup_dump_cb,
-                       BlockDriverCompletionFunc *backup_complete_cb,
-                       void *opaque, int64_t speed);
- 
-+typedef struct BackupDriver {
-+    const char *format;
-+    void *(*open)(const char *filename, uuid_t uuid, Error **errp);
-+    int (*close)(void *opaque, Error **errp);
-+    int (*register_config)(void *opaque, const char *name, gpointer data,
-+                              size_t data_len);
-+    int (*register_stream)(void *opaque, const char *devname, size_t size);
-+    int (*dump)(void *opaque, uint8_t dev_id, int64_t cluster_num,
-+                   unsigned char *buf, size_t *zero_bytes);
-+    int (*complete)(void *opaque, uint8_t dev_id, int ret);
-+} BackupDriver;
-+
- #endif /* QEMU_BACKUP_H */
-diff --git a/blockdev.c b/blockdev.c
-index 63e6f1e..84f598d 100644
---- a/blockdev.c
-+++ b/blockdev.c
-@@ -20,6 +20,7 @@
- #include "qmp-commands.h"
- #include "trace.h"
- #include "sysemu/arch_init.h"
-+#include "backup.h"
- 
- static QTAILQ_HEAD(drivelist, DriveInfo) drives = QTAILQ_HEAD_INITIALIZER(drives);
- 
-@@ -1334,6 +1335,428 @@ void qmp_drive_mirror(const char *device, const char *target,
-     drive_get_ref(drive_get_by_blockdev(bs));
- }
- 
-+/* Backup related function */
-+
-+static void backup_run_next_job(void);
-+
-+static struct GenericBackupState {
-+    Error *error;
-+    bool cancel;
-+    uuid_t uuid;
-+    char uuid_str[37];
-+    int64_t speed;
-+    time_t start_time;
-+    time_t end_time;
-+    char *backup_file;
-+    const BackupDriver *driver;
-+    void *writer;
-+    GList *bcb_list;
-+    size_t total;
-+    size_t transferred;
-+    size_t zero_bytes;
-+} backup_state;
-+
-+typedef struct BackupCB {
-+    BlockDriverState *bs;
-+    uint8_t dev_id;
-+    bool started;
-+    bool completed;
-+    size_t size;
-+    size_t transferred;
-+    size_t zero_bytes;
-+} BackupCB;
-+
-+static int backup_dump_cb(void *opaque, BlockDriverState *bs,
-+                          int64_t cluster_num, unsigned char *buf)
-+{
-+    BackupCB *bcb = opaque;
-+
-+    assert(backup_state.driver);
-+    assert(backup_state.writer);
-+    assert(backup_state.driver->dump);
-+
-+    size_t zero_bytes = 0;
-+    int bytes = backup_state.driver->dump(backup_state.writer,
-+                                          bcb->dev_id, cluster_num,
-+                                          buf, &zero_bytes);
-+
-+    if (bytes > 0) {
-+        bcb->transferred += bytes;
-+        backup_state.transferred += bytes;
-+        if (zero_bytes) {
-+            bcb->zero_bytes += bytes;
-+            backup_state.zero_bytes += zero_bytes;
-+        }
-+    }
-+
-+    return bytes;
-+}
-+
-+static void backup_cleanup(void)
-+{
-+    if (backup_state.writer && backup_state.driver) {
-+        backup_state.end_time = time(NULL);
-+        Error *local_err = NULL;
-+        backup_state.driver->close(backup_state.writer, &local_err);
-+        error_propagate(&backup_state.error, local_err);
-+        backup_state.writer = NULL;
-+    }
-+
-+    if (backup_state.bcb_list) {
-+        GList *l = backup_state.bcb_list;
-+        while (l) {
-+            BackupCB *bcb = l->data;
-+            l = g_list_next(l);
-+            drive_put_ref_bh_schedule(drive_get_by_blockdev(bcb->bs));
-+            g_free(bcb);
-+        }
-+        g_list_free(backup_state.bcb_list);
-+        backup_state.bcb_list = NULL;
-+    }
-+}
-+
-+static void backup_complete_cb(void *opaque, int ret)
-+{
-+    BackupCB *bcb = opaque;
-+
-+    assert(backup_state.driver);
-+    assert(backup_state.writer);
-+    assert(backup_state.driver->complete);
-+    assert(backup_state.driver->close);
-+
-+    bcb->completed = true;
-+
-+    backup_state.driver->complete(backup_state.writer, bcb->dev_id, ret);
-+
-+    if (!backup_state.cancel) {
-+        backup_run_next_job();
-+    }
-+}
-+
-+static void backup_cancel(void)
-+{
-+    backup_state.cancel = true;
-+
-+    if (!backup_state.error) {
-+        error_setg(&backup_state.error, "backup cancelled");
-+    }
-+
-+    /* drain all i/o (awake jobs waiting for aio) */
-+    bdrv_drain_all();
-+
-+    int job_count = 0;
-+    GList *l = backup_state.bcb_list;
-+    while (l) {
-+        BackupCB *bcb = l->data;
-+        l = g_list_next(l);
-+        BlockJob *job = bcb->bs->job;
-+        if (job) {
-+            job_count++;
-+            if (!bcb->started) {
-+                bcb->started = true;
-+                backup_job_start(bcb->bs, true);
-+            }
-+            if (!bcb->completed) {
-+                block_job_cancel_sync(job);
-+            }
-+        }
-+    }
-+
-+    backup_cleanup();
-+}
-+
-+void qmp_backup_cancel(Error **errp)
-+{
-+    backup_cancel();
-+}
-+
-+static void backup_run_next_job(void)
-+{
-+    GList *l = backup_state.bcb_list;
-+    while (l) {
-+        BackupCB *bcb = l->data;
-+        l = g_list_next(l);
-+
-+        if (bcb->bs && bcb->bs->job && !bcb->completed) {
-+            if (!bcb->started) {
-+                bcb->started = true;
-+                bool cancel = backup_state.error || backup_state.cancel;
-+                backup_job_start(bcb->bs, cancel);
-+            }
-+            return;
-+        }
-+    }
-+
-+    backup_cleanup();
-+}
-+
-+static void backup_start_jobs(void)
-+{
-+    /* create all jobs (one for each device), start first one */
-+    GList *l = backup_state.bcb_list;
-+    while (l) {
-+        BackupCB *bcb = l->data;
-+        l = g_list_next(l);
-+
-+        if (backup_job_create(bcb->bs, backup_dump_cb, backup_complete_cb,
-+                              bcb, backup_state.speed) != 0) {
-+            error_setg(&backup_state.error, "backup_job_create failed");
-+            backup_cancel();
-+            return;
-+        }
-+    }
-+
-+    backup_run_next_job();
-+}
-+
-+char *qmp_backup(const char *backup_file, bool has_format, BackupFormat format,
-+                 bool has_config_file, const char *config_file,
-+                 bool has_devlist, const char *devlist,
-+                 bool has_speed, int64_t speed, Error **errp)
-+{
-+    BlockDriverState *bs;
-+    Error *local_err = NULL;
-+    uuid_t uuid;
-+    void *writer = NULL;
-+    gchar **devs = NULL;
-+    GList *bcblist = NULL;
-+
-+    if (backup_state.bcb_list) {
-+        error_set(errp, ERROR_CLASS_GENERIC_ERROR,
-+                  "previous backup not finished");
-+        return NULL;
-+    }
-+
-+    /* Todo: try to auto-detect format based on file name */
-+    format = has_format ? format : BACKUP_FORMAT_VMA;
-+
-+    /* fixme: find driver for specifued format */
-+    const BackupDriver *driver = NULL;
-+
-+    if (!driver) {
-+        error_set(errp, ERROR_CLASS_GENERIC_ERROR, "unknown backup format");
-+        return NULL;
-+    }
-+
-+    if (has_devlist) {
-+        devs = g_strsplit_set(devlist, ",;:", -1);
-+
-+        gchar **d = devs;
-+        while (d && *d) {
-+            bs = bdrv_find(*d);
-+            if (bs) {
-+                if (bdrv_is_read_only(bs)) {
-+                    error_set(errp, QERR_DEVICE_IS_READ_ONLY, *d);
-+                    goto err;
-+                }
-+                if (!bdrv_is_inserted(bs)) {
-+                    error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, *d);
-+                    goto err;
-+                }
-+                BackupCB *bcb = g_new0(BackupCB, 1);
-+                bcb->bs = bs;
-+                bcblist = g_list_append(bcblist, bcb);
-+            } else {
-+                error_set(errp, QERR_DEVICE_NOT_FOUND, *d);
-+                goto err;
-+            }
-+            d++;
-+        }
-+
-+    } else {
-+
-+        bs = NULL;
-+        while ((bs = bdrv_next(bs))) {
-+
-+            if (!bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) {
-+                continue;
-+            }
-+
-+            BackupCB *bcb = g_new0(BackupCB, 1);
-+            bcb->bs = bs;
-+            bcblist = g_list_append(bcblist, bcb);
-+        }
-+    }
-+
-+    if (!bcblist) {
-+        error_set(errp, ERROR_CLASS_GENERIC_ERROR, "empty device list");
-+        goto err;
-+    }
-+
-+    GList *l = bcblist;
-+    while (l) {
-+        BackupCB *bcb = l->data;
-+        l = g_list_next(l);
-+        if (bcb->bs->job) {
-+            error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bcb->bs));
-+            goto err;
-+        }
-+    }
-+
-+    uuid_generate(uuid);
-+
-+    writer = driver->open(backup_file, uuid, &local_err);
-+    if (!writer) {
-+        if (error_is_set(&local_err)) {
-+            error_propagate(errp, local_err);
-+        }
-+        goto err;
-+    }
-+
-+    size_t total = 0;
-+
-+    /* register all devices for vma writer */
-+    l = bcblist;
-+    while (l) {
-+        BackupCB *bcb = l->data;
-+        l = g_list_next(l);
-+
-+        int64_t size = bdrv_getlength(bcb->bs);
-+        const char *devname = bdrv_get_device_name(bcb->bs);
-+        bcb->dev_id = driver->register_stream(writer, devname, size);
-+        if (bcb->dev_id <= 0) {
-+            error_set(errp, ERROR_CLASS_GENERIC_ERROR,
-+                      "register_stream failed");
-+            goto err;
-+        }
-+        bcb->size = size;
-+        total += size;
-+    }
-+
-+    /* add configuration file to archive */
-+    if (has_config_file) {
-+        char *cdata = NULL;
-+        gsize clen = 0;
-+        GError *err = NULL;
-+        if (!g_file_get_contents(config_file, &cdata, &clen, &err)) {
-+            error_setg(errp, "unable to read file '%s'", config_file);
-+            goto err;
-+        }
-+
-+        const char *basename = g_path_get_basename(config_file);
-+        if (driver->register_config(writer, basename, cdata, clen) < 0) {
-+            error_setg(errp, "register_config failed");
-+            g_free(cdata);
-+            goto err;
-+        }
-+        g_free(cdata);
-+    }
-+
-+    /* initialize global backup_state now */
-+
-+    backup_state.cancel = false;
-+
-+    if (backup_state.error) {
-+        error_free(backup_state.error);
-+        backup_state.error = NULL;
-+    }
-+
-+    backup_state.driver = driver;
-+
-+    backup_state.speed = (has_speed && speed > 0) ? speed : 0;
-+
-+    backup_state.start_time = time(NULL);
-+    backup_state.end_time = 0;
-+
-+    if (backup_state.backup_file) {
-+        g_free(backup_state.backup_file);
-+    }
-+    backup_state.backup_file = g_strdup(backup_file);
-+
-+    backup_state.writer = writer;
-+
-+    uuid_copy(backup_state.uuid, uuid);
-+    uuid_unparse_lower(uuid, backup_state.uuid_str);
-+
-+    backup_state.bcb_list = bcblist;
-+
-+    backup_state.total = total;
-+    backup_state.transferred = 0;
-+    backup_state.zero_bytes = 0;
-+
-+    /* Grab a reference so hotplug does not delete the
-+     * BlockDriverState from underneath us.
-+     */
-+    l = bcblist;
-+    while (l) {
-+        BackupCB *bcb = l->data;
-+        l = g_list_next(l);
-+        drive_get_ref(drive_get_by_blockdev(bcb->bs));
-+    }
-+
-+    backup_start_jobs();
-+
-+    return g_strdup(backup_state.uuid_str);
-+
-+err:
-+
-+    l = bcblist;
-+    while (l) {
-+        g_free(l->data);
-+        l = g_list_next(l);
-+    }
-+    g_list_free(bcblist);
-+
-+    if (devs) {
-+        g_strfreev(devs);
-+    }
-+
-+    if (writer) {
-+        unlink(backup_file);
-+        if (driver) {
-+            Error *err = NULL;
-+            driver->close(writer, &err);
-+        }
-+    }
-+
-+    return NULL;
-+}
-+
-+BackupStatus *qmp_query_backup(Error **errp)
-+{
-+    BackupStatus *info = g_malloc0(sizeof(*info));
-+
-+    if (!backup_state.start_time) {
-+        /* not started, return {} */
-+        return info;
-+    }
-+
-+    info->has_status = true;
-+    info->has_start_time = true;
-+    info->start_time = backup_state.start_time;
-+
-+    if (backup_state.backup_file) {
-+        info->has_backup_file = true;
-+        info->backup_file = g_strdup(backup_state.backup_file);
-+    }
-+
-+    info->has_uuid = true;
-+    info->uuid = g_strdup(backup_state.uuid_str);
-+
-+    if (backup_state.end_time) {
-+        if (backup_state.error) {
-+            info->status = g_strdup("error");
-+            info->has_errmsg = true;
-+            info->errmsg = g_strdup(error_get_pretty(backup_state.error));
-+        } else {
-+            info->status = g_strdup("done");
-+        }
-+        info->has_end_time = true;
-+        info->end_time = backup_state.end_time;
-+    } else {
-+        info->status = g_strdup("active");
-+    }
-+
-+    info->has_total = true;
-+    info->total = backup_state.total;
-+    info->has_zero_bytes = true;
-+    info->zero_bytes = backup_state.zero_bytes;
-+    info->has_transferred = true;
-+    info->transferred = backup_state.transferred;
-+
-+    return info;
-+}
-+
- static BlockJob *find_block_job(const char *device)
- {
-     BlockDriverState *bs;
-diff --git a/hmp-commands.hx b/hmp-commands.hx
-index 64008a9..0f178d8 100644
---- a/hmp-commands.hx
-+++ b/hmp-commands.hx
-@@ -83,6 +83,35 @@ STEXI
- Copy data from a backing file into a block device.
- ETEXI
- 
-+   {
-+        .name       = "backup",
-+        .args_type  = "backupfile:s,speed:o?,devlist:s?",
-+        .params     = "backupfile [speed [devlist]]",
-+        .help       = "create a VM Backup.",
-+        .mhandler.cmd = hmp_backup,
-+    },
-+
-+STEXI
-+ at item backup
-+ at findex backup
-+Create a VM backup.
-+ETEXI
-+
-+    {
-+        .name       = "backup_cancel",
-+        .args_type  = "",
-+        .params     = "",
-+        .help       = "cancel the current VM backup",
-+        .mhandler.cmd = hmp_backup_cancel,
-+    },
-+
-+STEXI
-+ at item backup_cancel
-+ at findex backup_cancel
-+Cancel the current VM backup.
-+
-+ETEXI
-+
-     {
-         .name       = "block_job_set_speed",
-         .args_type  = "device:B,speed:o",
-@@ -1630,6 +1659,8 @@ show CPU statistics
- show user network stack connection states
- @item info migrate
- show migration status
-+ at item info backup
-+show backup status
- @item info migrate_capabilities
- show current migration capabilities
- @item info migrate_cache_size
-diff --git a/hmp.c b/hmp.c
-index 2f47a8a..b2c1f23 100644
---- a/hmp.c
-+++ b/hmp.c
-@@ -131,6 +131,38 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict)
-     qapi_free_MouseInfoList(mice_list);
- }
- 
-+void hmp_info_backup(Monitor *mon, const QDict *qdict)
-+{
-+    BackupStatus *info;
-+
-+    info = qmp_query_backup(NULL);
-+    if (info->has_status) {
-+        if (info->has_errmsg) {
-+            monitor_printf(mon, "Backup status: %s - %s\n",
-+                           info->status, info->errmsg);
-+        } else {
-+            monitor_printf(mon, "Backup status: %s\n", info->status);
-+        }
-+    }
-+    if (info->has_backup_file) {
-+        int per = (info->has_total && info->total &&
-+            info->has_transferred && info->transferred) ?
-+            (info->transferred * 100)/info->total : 0;
-+        int zero_per = (info->has_total && info->total &&
-+                        info->has_zero_bytes && info->zero_bytes) ?
-+            (info->zero_bytes * 100)/info->total : 0;
-+        monitor_printf(mon, "Backup file: %s\n", info->backup_file);
-+        monitor_printf(mon, "Backup uuid: %s\n", info->uuid);
-+        monitor_printf(mon, "Total size: %zd\n", info->total);
-+        monitor_printf(mon, "Transferred bytes: %zd (%d%%)\n",
-+                       info->transferred, per);
-+        monitor_printf(mon, "Zero bytes: %zd (%d%%)\n",
-+                       info->zero_bytes, zero_per);
-+    }
-+
-+    qapi_free_BackupStatus(info);
-+}
-+
- void hmp_info_migrate(Monitor *mon, const QDict *qdict)
- {
-     MigrationInfo *info;
-@@ -998,6 +1030,37 @@ void hmp_block_stream(Monitor *mon, const QDict *qdict)
-     hmp_handle_error(mon, &error);
- }
- 
-+void hmp_backup_cancel(Monitor *mon, const QDict *qdict)
-+{
-+    Error *errp = NULL;
-+
-+    qmp_backup_cancel(&errp);
-+
-+    if (error_is_set(&errp)) {
-+        monitor_printf(mon, "%s\n", error_get_pretty(errp));
-+        error_free(errp);
-+        return;
-+    }
-+}
-+
-+void hmp_backup(Monitor *mon, const QDict *qdict)
-+{
-+    const char *backup_file = qdict_get_str(qdict, "backup-file");
-+    const char *devlist = qdict_get_try_str(qdict, "devlist");
-+    int64_t speed = qdict_get_try_int(qdict, "speed", 0);
-+
-+    Error *errp = NULL;
-+
-+    qmp_backup(backup_file, true, BACKUP_FORMAT_VMA, false, NULL, !!devlist,
-+               devlist, qdict_haskey(qdict, "speed"), speed, &errp);
-+
-+    if (error_is_set(&errp)) {
-+        monitor_printf(mon, "%s\n", error_get_pretty(errp));
-+        error_free(errp);
-+        return;
-+    }
-+}
-+
- void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict)
- {
-     Error *error = NULL;
-diff --git a/hmp.h b/hmp.h
-index 30b3c20..ad4cf80 100644
---- a/hmp.h
-+++ b/hmp.h
-@@ -28,6 +28,7 @@ void hmp_info_mice(Monitor *mon, const QDict *qdict);
- void hmp_info_migrate(Monitor *mon, const QDict *qdict);
- void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
- void hmp_info_migrate_cache_size(Monitor *mon, const QDict *qdict);
-+void hmp_info_backup(Monitor *mon, const QDict *qdict);
- void hmp_info_cpus(Monitor *mon, const QDict *qdict);
- void hmp_info_block(Monitor *mon, const QDict *qdict);
- void hmp_info_blockstats(Monitor *mon, const QDict *qdict);
-@@ -65,6 +66,8 @@ void hmp_eject(Monitor *mon, const QDict *qdict);
- void hmp_change(Monitor *mon, const QDict *qdict);
- void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict);
- void hmp_block_stream(Monitor *mon, const QDict *qdict);
-+void hmp_backup(Monitor *mon, const QDict *qdict);
-+void hmp_backup_cancel(Monitor *mon, const QDict *qdict);
- void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict);
- void hmp_block_job_cancel(Monitor *mon, const QDict *qdict);
- void hmp_block_job_pause(Monitor *mon, const QDict *qdict);
-diff --git a/monitor.c b/monitor.c
-index 6a0f257..e4a810c 100644
---- a/monitor.c
-+++ b/monitor.c
-@@ -2666,6 +2666,13 @@ static mon_cmd_t info_cmds[] = {
-     },
- #endif
-     {
-+        .name       = "backup",
-+        .args_type  = "",
-+        .params     = "",
-+        .help       = "show backup status",
-+        .mhandler.cmd = hmp_info_backup,
-+    },
-+    {
-         .name       = "migrate",
-         .args_type  = "",
-         .params     = "",
-diff --git a/qapi-schema.json b/qapi-schema.json
-index 7275b5d..09ca8ef 100644
---- a/qapi-schema.json
-+++ b/qapi-schema.json
-@@ -425,6 +425,39 @@
- { 'type': 'EventInfo', 'data': {'name': 'str'} }
- 
- ##
-+# @BackupStatus:
-+#
-+# Detailed backup status.
-+#
-+# @status: #optional string describing the current backup status.
-+#          This can be 'active', 'done', 'error'. If this field is not
-+#          returned, no backup process has been initiated
-+#
-+# @errmsg: #optional error message (only returned if status is 'error')
-+#
-+# @total: #optional total amount of bytes involved in the backup process
-+#
-+# @transferred: #optional amount of bytes already backed up.
-+#
-+# @zero-bytes: #optional amount of 'zero' bytes detected.
-+#
-+# @start-time: #optional time (epoch) when backup job started.
-+#
-+# @end-time: #optional time (epoch) when backup job finished.
-+#
-+# @backupfile: #optional backup file name
-+#
-+# @uuid: #optional uuid for this backup job
-+#
-+# Since: 1.5.0
-+##
-+{ 'type': 'BackupStatus',
-+  'data': {'*status': 'str', '*errmsg': 'str', '*total': 'int',
-+           '*transferred': 'int', '*zero-bytes': 'int',
-+           '*start-time': 'int', '*end-time': 'int',
-+           '*backup-file': 'str', '*uuid': 'str' } }
-+
-+##
- # @query-events:
- #
- # Return a list of supported QMP events by this server
-@@ -1824,6 +1857,68 @@
-   'data': { 'path': 'str' },
-   'returns': [ 'ObjectPropertyInfo' ] }
- 
-+
-+##
-+# @BackupFormat
-+#
-+# An enumeration of supported backup formats.
-+#
-+# @vma: Proxmox vma backup format
-+##
-+{ 'enum': 'BackupFormat',
-+  'data': [ 'vma' ] }
-+
-+##
-+# @backup:
-+#
-+# Starts a VM backup.
-+#
-+# @backup-file: the backup file name
-+#
-+# @format: format of the backup file
-+#
-+# @config-filename: #optional name of a configuration file to include into
-+# the backup archive.
-+#
-+# @speed: #optional the maximum speed, in bytes per second
-+#
-+# @devlist: #optional list of block device names (separated by ',', ';'
-+# or ':'). By default the backup includes all writable block devices.
-+#
-+# Returns: the uuid of the backup job
-+#
-+# Since: 1.5.0
-+##
-+{ 'command': 'backup', 'data': { 'backup-file': 'str',
-+                                 '*format': 'BackupFormat',
-+                                 '*config-file': 'str',
-+                                 '*devlist': 'str', '*speed': 'int' },
-+  'returns': 'str' }
-+
-+##
-+# @query-backup
-+#
-+# Returns information about current/last backup task.
-+#
-+# Returns: @BackupStatus
-+#
-+# Since: 1.5.0
-+##
-+{ 'command': 'query-backup', 'returns': 'BackupStatus' }
-+
-+##
-+# @backup-cancel
-+#
-+# Cancel the current executing backup process.
-+#
-+# Returns: nothing on success
-+#
-+# Notes: This command succeeds even if there is no backup process running.
-+#
-+# Since: 1.5.0
-+##
-+{ 'command': 'backup-cancel' }
-+
- ##
- # @qom-get:
- #
-diff --git a/qmp-commands.hx b/qmp-commands.hx
-index 799adea..17e381b 100644
---- a/qmp-commands.hx
-+++ b/qmp-commands.hx
-@@ -889,6 +889,18 @@ EQMP
-     },
- 
-     {
-+        .name       = "backup",
-+        .args_type  = "backup-file:s,format:s?,config-file:F?,speed:o?,devlist:s?",
-+        .mhandler.cmd_new = qmp_marshal_input_backup,
-+    },
-+
-+    {
-+        .name       = "backup-cancel",
-+        .args_type  = "",
-+        .mhandler.cmd_new = qmp_marshal_input_backup_cancel,
-+    },
-+
-+    {
-         .name       = "block-job-set-speed",
-         .args_type  = "device:B,speed:o",
-         .mhandler.cmd_new = qmp_marshal_input_block_job_set_speed,
-@@ -2566,6 +2578,21 @@ EQMP
-     },
- 
- SQMP
-+
-+query-backup
-+-------------
-+
-+Backup status.
-+
-+EQMP
-+
-+    {
-+        .name       = "query-backup",
-+        .args_type  = "",
-+        .mhandler.cmd_new = qmp_marshal_input_query_backup,
-+    },
-+
-+SQMP
- migrate-set-capabilities
- -------
- 
--- 
-1.7.2.5
-
diff --git a/debian/patches/backup-add-dir-format.patch b/debian/patches/backup-add-dir-format.patch
index ea87701..3523a48 100644
--- a/debian/patches/backup-add-dir-format.patch
+++ b/debian/patches/backup-add-dir-format.patch
@@ -47,9 +47,9 @@ Index: new/blockdev.c
      block_job_cb(bs, ret);
  
 @@ -2138,6 +2141,7 @@
-                     bool has_speed, int64_t speed, Error **errp)
  {
-     BlockDriverState *bs;
+     BlockBackend *blk;
+     BlockDriverState *bs = NULL;
 +    const char *backup_dir = NULL;
      Error *local_err = NULL;
      uuid_t uuid;
diff --git a/debian/patches/backup-add-pve-monitor-commands.patch b/debian/patches/backup-add-pve-monitor-commands.patch
index 6a2cd61..e58033e 100644
--- a/debian/patches/backup-add-pve-monitor-commands.patch
+++ b/debian/patches/backup-add-pve-monitor-commands.patch
@@ -10,7 +10,7 @@ Index: new/blockdev.c
  
  static const char *const if_name[IF_COUNT] = {
      [IF_NONE] = "none",
-@@ -1954,6 +1955,437 @@
+@@ -1954,6 +1955,439 @@
      bdrv_put_ref_bh_schedule(bs);
  }
  
@@ -196,7 +196,8 @@ Index: new/blockdev.c
 +                    bool has_devlist, const char *devlist,
 +                    bool has_speed, int64_t speed, Error **errp)
 +{
-+    BlockDriverState *bs;
++    BlockBackend *blk;
++    BlockDriverState *bs = NULL;
 +    Error *local_err = NULL;
 +    uuid_t uuid;
 +    VmaWriter *vmaw = NULL;
@@ -223,8 +224,9 @@ Index: new/blockdev.c
 +
 +        gchar **d = devs;
 +        while (d && *d) {
-+            bs = bdrv_find(*d);
-+            if (bs) {
++            blk = blk_by_name(*d);
++            if (blk) {
++                bs = blk_bs(blk);
 +                if (bdrv_is_read_only(bs)) {
 +                    error_set(errp, QERR_DEVICE_IS_READ_ONLY, *d);
 +                    goto err;
diff --git a/debian/patches/backup-add-vma-binary.patch b/debian/patches/backup-add-vma-binary.patch
index 366af84..6fbd7ad 100644
--- a/debian/patches/backup-add-vma-binary.patch
+++ b/debian/patches/backup-add-vma-binary.patch
@@ -26,7 +26,7 @@ Index: new/Makefile
 ===================================================================
 --- new.orig/Makefile	2014-11-20 08:12:54.000000000 +0100
 +++ new/Makefile	2014-11-20 08:15:12.000000000 +0100
-@@ -152,7 +152,7 @@
+@@ -156,7 +156,7 @@
  include $(SRC_PATH)/libcacard/Makefile
  endif
  
@@ -35,7 +35,7 @@ Index: new/Makefile
  
  config-host.h: config-host.h-timestamp
  config-host.h-timestamp: config-host.mak
-@@ -220,6 +220,7 @@
+@@ -224,6 +224,7 @@
  qemu-img$(EXESUF): qemu-img.o $(block-obj-y) libqemuutil.a libqemustub.a
  qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) libqemuutil.a libqemustub.a
  qemu-io$(EXESUF): qemu-io.o $(block-obj-y) libqemuutil.a libqemustub.a
diff --git a/debian/patches/backup-modify-job-api.patch b/debian/patches/backup-modify-job-api.patch
index 53aa7be..f5e81a7 100644
--- a/debian/patches/backup-modify-job-api.patch
+++ b/debian/patches/backup-modify-job-api.patch
@@ -77,18 +77,20 @@ Index: new/block/backup.c
  
      bdrv_add_before_write_notifier(bs, &before_write);
  
-@@ -359,7 +373,9 @@
+@@ -359,8 +373,10 @@
  
      hbitmap_free(job->bitmap);
  
 -    bdrv_iostatus_disable(target);
+-    bdrv_op_unblock_all(target, job->common.blocker);
 +    if (target) {
 +        bdrv_iostatus_disable(target);
++        bdrv_op_unblock_all(target, job->common.blocker);
 +    }
  
      data = g_malloc(sizeof(*data));
      data->ret = ret;
-@@ -370,13 +386,15 @@
+@@ -370,13 +386,15 @@ for backup_start
                    int64_t speed, MirrorSyncMode sync_mode,
                    BlockdevOnError on_source_error,
                    BlockdevOnError on_target_error,
@@ -104,11 +106,33 @@ Index: new/block/backup.c
 +    assert(target || dump_cb);
      assert(cb);
  
-     if ((on_source_error == BLOCKDEV_ON_ERROR_STOP ||
-@@ -399,10 +417,12 @@
+     if (bs == target) {
+@@ -419,7 +437,7 @@ in backup_start
          return;
      }
  
+-    if (!bdrv_is_inserted(target)) {
++    if (target && !bdrv_is_inserted(target)) {
+         error_setg(errp, "Device is not inserted: %s",
+                    bdrv_get_device_name(target));
+         return;
+@@ -429,7 +447,7 @@ in backup_start
+         return;
+     }
+ 
+-    if (bdrv_op_is_blocked(target, BLOCK_OP_TYPE_BACKUP_TARGET, errp)) {
++    if (target && bdrv_op_is_blocked(target, BLOCK_OP_TYPE_BACKUP_TARGET, errp)) {
+         return;
+     }
+ 
+@@ -397,12 +415,15 @@ in backup_start
+         return;
+     }
+ 
+-    bdrv_op_block_all(target, job->common.blocker);
++    if (target)
++        bdrv_op_block_all(target, job->common.blocker);
+ 
 +    job->dump_cb = dump_cb;
      job->on_source_error = on_source_error;
      job->on_target_error = on_target_error;
@@ -122,7 +146,7 @@ Index: new/blockdev.c
 ===================================================================
 --- new.orig/blockdev.c	2014-11-20 07:55:31.000000000 +0100
 +++ new/blockdev.c	2014-11-20 08:48:02.000000000 +0100
-@@ -2223,7 +2223,7 @@
+@@ -2223,7 +2223,7 @@ qmp_drive_backup
      bdrv_set_aio_context(target_bs, aio_context);
  
      backup_start(bs, target_bs, speed, sync, on_source_error, on_target_error,
@@ -131,13 +155,22 @@ Index: new/blockdev.c
      if (local_err != NULL) {
          bdrv_unref(target_bs);
          error_propagate(errp, local_err);
+@@ -2284,7 +2284,7 @@ qmp_blockdev_backup
+     bdrv_ref(target_bs);
+     bdrv_set_aio_context(target_bs, aio_context);
+     backup_start(bs, target_bs, speed, sync, on_source_error, on_target_error,
+-                 block_job_cb, bs, &local_err);
++                 NULL, block_job_cb, bs, false, &local_err);
+     if (local_err != NULL) {
+         bdrv_unref(target_bs);
+         error_propagate(errp, local_err);
 Index: new/include/block/block_int.h
 ===================================================================
 --- new.orig/include/block/block_int.h	2014-11-20 07:55:31.000000000 +0100
 +++ new/include/block/block_int.h	2014-11-20 08:52:59.000000000 +0100
 @@ -57,6 +57,9 @@
- #define BLOCK_OPT_REDUNDANCY        "redundancy"
- #define BLOCK_OPT_NOCOW             "nocow"
+ 
+ #define BLOCK_PROBE_BUF_SIZE        512
  
 +typedef int BackupDumpFunc(void *opaque, BlockDriverState *bs,
 +                           int64_t sector_num, int n_sectors, unsigned char *buf);
diff --git a/debian/patches/disable-efi-enable-pxe-roms.patch b/debian/patches/disable-efi-enable-pxe-roms.patch
index 9c9d7a2..16c69ce 100644
--- a/debian/patches/disable-efi-enable-pxe-roms.patch
+++ b/debian/patches/disable-efi-enable-pxe-roms.patch
@@ -4,7 +4,7 @@ Index: new/hw/net/e1000.c
 +++ new/hw/net/e1000.c	2014-11-20 07:54:14.000000000 +0100
 @@ -1606,7 +1606,7 @@
  
-     k->init = pci_e1000_init;
+     k->realize = pci_e1000_realize;
      k->exit = pci_e1000_uninit;
 -    k->romfile = "efi-e1000.rom";
 +    k->romfile = "pxe-e1000.rom";
@@ -17,7 +17,7 @@ Index: new/hw/net/ne2000.c
 +++ new/hw/net/ne2000.c	2014-11-20 07:54:14.000000000 +0100
 @@ -773,7 +773,7 @@
  
-     k->init = pci_ne2000_init;
+     k->realize = pci_ne2000_realize;
      k->exit = pci_ne2000_exit;
 -    k->romfile = "efi-ne2k_pci.rom",
 +    k->romfile = "pxe-ne2k_pci.rom",
@@ -30,7 +30,7 @@ Index: new/hw/net/pcnet-pci.c
 +++ new/hw/net/pcnet-pci.c	2014-11-20 07:54:14.000000000 +0100
 @@ -367,7 +367,7 @@
  
-     k->init = pci_pcnet_init;
+     k->realize = pci_pcnet_realize;
      k->exit = pci_pcnet_uninit;
 -    k->romfile = "efi-pcnet.rom",
 +    k->romfile = "pxe-pcnet.rom",
@@ -43,7 +43,7 @@ Index: new/hw/net/rtl8139.c
 +++ new/hw/net/rtl8139.c	2014-11-20 07:54:14.000000000 +0100
 @@ -3562,7 +3562,7 @@
  
-     k->init = pci_rtl8139_init;
+     k->realize = pci_rtl8139_realize;
      k->exit = pci_rtl8139_uninit;
 -    k->romfile = "efi-rtl8139.rom";
 +    k->romfile = "pxe-rtl8139.rom";
diff --git a/debian/patches/fairsched.diff b/debian/patches/fairsched.diff
deleted file mode 100644
index e01023f..0000000
--- a/debian/patches/fairsched.diff
+++ /dev/null
@@ -1,163 +0,0 @@
-Index: new/qemu-options.hx
-===================================================================
---- new.orig/qemu-options.hx	2014-11-20 06:45:06.000000000 +0100
-+++ new/qemu-options.hx	2014-11-20 06:50:44.000000000 +0100
-@@ -386,6 +386,12 @@
- @table @option
- ETEXI
- 
-+DEF("id", HAS_ARG, QEMU_OPTION_id,
-+    "-id n	     set the faisched ID\n", QEMU_ARCH_ALL)
-+
-+DEF("cpuunits",  HAS_ARG, QEMU_OPTION_cpuunits,
-+    "-cpuuinits n    set fairsched cpu units\n", QEMU_ARCH_ALL)
-+
- DEF("fda", HAS_ARG, QEMU_OPTION_fda,
-     "-fda/-fdb file  use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL)
- DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL)
-Index: new/vl.c
-===================================================================
---- new.orig/vl.c	2014-11-20 06:45:06.000000000 +0100
-+++ new/vl.c	2014-11-20 06:50:44.000000000 +0100
-@@ -101,6 +101,8 @@
- #endif
- #include "sysemu/qtest.h"
- 
-+#include "vzsyscalls.h"
-+
- #include "disas/disas.h"
- 
- 
-@@ -154,6 +156,7 @@
- CharDriverState *sclp_hds[MAX_SCLP_CONSOLES];
- int win2k_install_hack = 0;
- int singlestep = 0;
-+int fairsched_id = 0;
- int smp_cpus = 1;
- int max_cpus = 0;
- int smp_cores = 1;
-@@ -2738,6 +2741,9 @@
- int main(int argc, char **argv, char **envp)
- {
-     int i;
-+    int cpuunits = 0;
-+    long int fairsched_id_long = 0;
-+    char *ep;
-     int snapshot, linux_boot;
-     const char *initrd_filename;
-     const char *kernel_filename, *kernel_cmdline;
-@@ -3560,6 +3566,21 @@
-                     exit(1);
-                 }
-                 break;
-+            case QEMU_OPTION_id:
-+                fairsched_id_long = strtol(optarg, &ep, 10);
-+                fairsched_id = fairsched_id_long;
-+		if (*ep != 0 || fairsched_id_long < 100 || fairsched_id_long > INT_MAX) {
-+		    fprintf(stderr, "Invalid ID\n");
-+		    exit(1);
-+		}
-+                break;
-+            case QEMU_OPTION_cpuunits:
-+                cpuunits = atoi(optarg);
-+		if (cpuunits < 8 || cpuunits > 500000) {
-+		    fprintf(stderr, "Invalid value for cpuunits\n");
-+                    exit(1);
-+                }
-+                break;
- 	    case QEMU_OPTION_vnc:
- #ifdef CONFIG_VNC
-                 display_remote++;
-@@ -3844,6 +3865,40 @@
-                           OBJECT_CLASS(machine_class))));
-     object_property_add_child(object_get_root(), "machine",
-                               OBJECT(current_machine), &error_abort);
-+
-+    if (cpuunits && !fairsched_id) {
-+        fprintf(stderr, "cpuunits specified without -id");
-+        exit(1);
-+    }
-+
-+    if (fairsched_id && cpuunits) {
-+	int ret;
-+	int weight = cpuunits ? 500000/cpuunits : 500;
-+	pid_t cpid = getpid();
-+
-+	ret = syscall(__NR_fairsched_rmnod, fairsched_id);
-+	if (ret == -EBUSY) {
-+	    fprintf (stderr, "unable to create fairsched node - still in use\n");
-+	    exit(1);
-+	}
-+
-+	ret = syscall(__NR_fairsched_mknod, 0, weight, fairsched_id);
-+	if (ret != fairsched_id) {
-+	    fprintf (stderr, "unable to create fairsched node\n");
-+	    exit(1);
-+	}
-+
-+	ret = syscall(__NR_fairsched_mvpr, cpid, fairsched_id);
-+	if (ret != 0) {
-+	    fprintf (stderr, "unable to move procces to fairsched group");
-+	    exit (1);
-+	}
-+
-+	/* note: we can never remove ourself from the group, so the empty group
-+	   will exist after we finish
-+	*/
-+    }
-+
-     cpu_exec_init_all();
- 
-     if (machine_class->hw_version) {
-Index: new/vzsyscalls.h
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ new/vzsyscalls.h	2014-11-20 06:50:44.000000000 +0100
-@@ -0,0 +1,47 @@
-+/*
-+ *  Copyright (C) 2000-2008, Parallels, Inc. All rights reserved.
-+ *
-+ *  This program is free software; you can redistribute it and/or modify
-+ *  it under the terms of the GNU General Public License as published by
-+ *  the Free Software Foundation; either version 2 of the License, or
-+ *  (at your option) any later version.
-+ *
-+ *  This program is distributed in the hope that it will be useful,
-+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ *  GNU General Public License for more details.
-+ *
-+ *  You should have received a copy of the GNU General Public License
-+ *  along with this program; if not, write to the Free Software
-+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+ */
-+#ifndef _VZSYSCALLS_H_
-+#define _VZSYSCALLS_H_
-+
-+#include <sys/syscall.h>
-+
-+#ifdef __x86_64__
-+#define __NR_fairsched_vcpus	499
-+#define __NR_setluid		501
-+#define __NR_setublimit		502
-+#define __NR_fairsched_mknod    504
-+#define __NR_fairsched_rmnod    505
-+#define __NR_fairsched_chwt	506
-+#define __NR_fairsched_mvpr     507
-+#define __NR_fairsched_rate	508
-+#define __NR_ioprio_set		251
-+#elif defined(__i386__)
-+#define __NR_fairsched_mknod    500
-+#define __NR_fairsched_rmnod    501
-+#define __NR_fairsched_chwt	502
-+#define __NR_fairsched_mvpr     503
-+#define __NR_fairsched_rate	504
-+#define __NR_fairsched_vcpus	505
-+#define __NR_setluid		511
-+#define __NR_setublimit		512
-+#define __NR_ioprio_set		289
-+#else
-+#error "no syscall for this arch"
-+#endif
-+
-+#endif
diff --git a/debian/patches/internal-snapshot-async.patch b/debian/patches/internal-snapshot-async.patch
index 52044f0..e6d8a13 100644
--- a/debian/patches/internal-snapshot-async.patch
+++ b/debian/patches/internal-snapshot-async.patch
@@ -25,19 +25,19 @@ Index: new/Makefile.objs
 ===================================================================
 --- new.orig/Makefile.objs	2014-11-20 09:13:01.000000000 +0100
 +++ new/Makefile.objs	2014-11-20 09:16:47.000000000 +0100
-@@ -56,6 +56,7 @@
+@@ -53,6 +53,7 @@
  common-obj-y += qemu-char.o #aio.o
- common-obj-y += block-migration.o
- common-obj-y += page_cache.o xbzrle.o
+ common-obj-y += page_cache.o
+ common-obj-y += qjson.o
 +common-obj-y += savevm-async.o
  
- common-obj-$(CONFIG_POSIX) += migration-exec.o migration-unix.o migration-fd.o
+ common-obj-$(CONFIG_SPICE) += spice-qemu-char.o
  
 Index: new/block.c
 ===================================================================
 --- new.orig/block.c	2014-11-20 09:13:01.000000000 +0100
 +++ new/block.c	2014-11-20 09:16:47.000000000 +0100
-@@ -2119,7 +2119,7 @@
+@@ -2202,7 +2202,7 @@
      bdrv_set_backing_hd(bs_top, bs_new);
  }
  
@@ -50,7 +50,7 @@ Index: new/hmp-commands.hx
 ===================================================================
 --- new.orig/hmp-commands.hx	2014-11-20 09:13:01.000000000 +0100
 +++ new/hmp-commands.hx	2014-11-20 09:16:47.000000000 +0100
-@@ -1799,6 +1799,8 @@
+@@ -1797,6 +1797,8 @@
  show current migration capabilities
  @item info migrate_cache_size
  show current migration XBZRLE cache size
@@ -99,7 +99,7 @@ Index: new/hmp.c
 ===================================================================
 --- new.orig/hmp.c	2014-11-20 09:13:01.000000000 +0100
 +++ new/hmp.c	2014-11-20 09:16:47.000000000 +0100
-@@ -1849,3 +1849,60 @@
+@@ -1849,6 +1849,63 @@
  
      qapi_free_MemoryDeviceInfoList(info_list);
  }
@@ -160,6 +160,9 @@ Index: new/hmp.c
 +        monitor_printf(mon, "Error: %s\n", info->error);
 +    }
 +}
+ 
+ void hmp_qom_list(Monitor *mon, const QDict *qdict)
+ {
 Index: new/hmp.h
 ===================================================================
 --- new.orig/hmp.h	2014-11-20 09:13:01.000000000 +0100
@@ -180,8 +183,8 @@ Index: new/hmp.h
 +void hmp_snapshot_drive(Monitor *mon, const QDict *qdict);
 +void hmp_delete_drive_snapshot(Monitor *mon, const QDict *qdict);
 +void hmp_savevm_end(Monitor *mon, const QDict *qdict);
- void hmp_send_key(Monitor *mon, const QDict *qdict);
- void hmp_screen_dump(Monitor *mon, const QDict *qdict);
+ void hmp_sendkey(Monitor *mon, const QDict *qdict);
+ void hmp_screendump(Monitor *mon, const QDict *qdict);
  void hmp_nbd_server_start(Monitor *mon, const QDict *qdict);
 Index: new/include/block/block.h
 ===================================================================
@@ -201,11 +204,11 @@ Index: new/include/sysemu/sysemu.h
 +++ new/include/sysemu/sysemu.h	2014-11-20 09:16:47.000000000 +0100
 @@ -76,16 +76,17 @@
  
- void do_savevm(Monitor *mon, const QDict *qdict);
+ void hmp_savevm(Monitor *mon, const QDict *qdict);
  int load_vmstate(const char *name);
 +int load_state_from_blockdev(const char *filename);
- void do_delvm(Monitor *mon, const QDict *qdict);
- void do_info_snapshots(Monitor *mon, const QDict *qdict);
+ void hmp_delvm(Monitor *mon, const QDict *qdict);
+ void hmp_info_snapshots(Monitor *mon, const QDict *qdict);
  
  void qemu_announce_self(void);
  
@@ -370,7 +373,7 @@ Index: new/savevm-async.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
 +++ new/savevm-async.c	2014-11-20 09:17:48.000000000 +0100
-@@ -0,0 +1,497 @@
+@@ -0,0 +1,503 @@
 +#include "qemu-common.h"
 +#include "qapi/qmp/qerror.h"
 +#include "sysemu/sysemu.h"
@@ -383,6 +386,7 @@ Index: new/savevm-async.c
 +#include "block/qapi.h"
 +#include "block/block.h"
 +#include "qemu/timer.h"
++#include "sysemu/block-backend.h"
 +
 +/* #define DEBUG_SAVEVM_STATE */
 +
@@ -695,6 +699,7 @@ Index: new/savevm-async.c
 +
 +void qmp_snapshot_drive(const char *device, const char *name, Error **errp)
 +{
++    BlockBackend *blk;
 +    BlockDriverState *bs;
 +    QEMUSnapshotInfo sn1, *sn = &sn1;
 +    int ret;
@@ -710,12 +715,13 @@ Index: new/savevm-async.c
 +        return;
 +    }
 +
-+    bs = bdrv_find(device);
-+    if (!bs) {
++    blk = blk_by_name(device);
++    if (!blk) {
 +        error_set(errp, QERR_DEVICE_NOT_FOUND, device);
 +        return;
 +    }
 +
++    bs = blk_bs(blk);
 +    if (!bdrv_is_inserted(bs)) {
 +        error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
 +        return;
@@ -766,17 +772,20 @@ Index: new/savevm-async.c
 +void qmp_delete_drive_snapshot(const char *device, const char *name,
 +                               Error **errp)
 +{
++    BlockBackend *blk;
 +    BlockDriverState *bs;
 +    QEMUSnapshotInfo sn1, *sn = &sn1;
 +    Error *local_err = NULL;
 +
 +    int ret;
 +
-+    bs = bdrv_find(device);
-+    if (!bs) {
++    blk = blk_by_name(device);
++    if (!blk) {
 +        error_set(errp, QERR_DEVICE_NOT_FOUND, device);
 +        return;
 +    }
++
++    bs = blk_bs(blk);
 +    if (bdrv_is_read_only(bs)) {
 +        error_set(errp, QERR_DEVICE_IS_READ_ONLY, device);
 +        return;
@@ -895,16 +904,16 @@ Index: new/savevm.c
  
  /*
 @@ -690,7 +691,7 @@
-     return ret;
+     return !machine->suppress_vmdesc;
  }
  
 -void qemu_savevm_state_complete(QEMUFile *f)
 +int qemu_savevm_state_complete(QEMUFile *f)
  {
-     SaveStateEntry *se;
-     int ret;
+     QJSON *vmdesc;
+     int vmdesc_len;
 @@ -717,7 +718,7 @@
-         trace_savevm_section_end(se->idstr, se->section_id);
+         trace_savevm_section_end(se->idstr, se->section_id, ret);
          if (ret < 0) {
              qemu_file_set_error(f, ret);
 -            return;
@@ -913,8 +922,8 @@ Index: new/savevm.c
      }
  
 @@ -746,6 +747,7 @@
+     object_unref(OBJECT(vmdesc));
  
-     qemu_put_byte(f, QEMU_VM_EOF);
      qemu_fflush(f);
 +    return qemu_file_get_error(f);
  }
@@ -933,9 +942,9 @@ Index: new/vl.c
      const char *cpu_model;
      const char *vga_model = NULL;
 @@ -3457,6 +3458,9 @@
- 	    case QEMU_OPTION_loadvm:
- 		loadvm = optarg;
- 		break;
+             case QEMU_OPTION_loadvm:
+                 loadvm = optarg;
+                 break;
 +            case QEMU_OPTION_loadstate:
 +                loadstate = optarg;
 +                break;
diff --git a/debian/patches/keymap.diff b/debian/patches/keymap.diff
index 1bd17d1..682cb9b 100644
--- a/debian/patches/keymap.diff
+++ b/debian/patches/keymap.diff
@@ -48,12 +48,3 @@ Index: new/ui/vnc.c
      trace_vnc_key_event_map(down, sym, keycode, code2name(keycode));
      do_key_event(vs, down, keycode, sym);
  }
-@@ -3046,7 +3068,7 @@
- char *vnc_display_local_addr(DisplayState *ds)
- {
-     VncDisplay *vs = vnc_display;
--    
-+
-     return vnc_socket_local_addr("%s:%s", vs->lsock);
- }
- 
diff --git a/debian/patches/pve-auth.patch b/debian/patches/pve-auth.patch
index 7036c84..0d1d43a 100644
--- a/debian/patches/pve-auth.patch
+++ b/debian/patches/pve-auth.patch
@@ -1,8 +1,61 @@
+Index: new/qemu-options.hx
+===================================================================
+--- new.orig/qemu-options.hx	2014-11-20 06:45:06.000000000 +0100
++++ new/qemu-options.hx	2014-11-20 06:50:44.000000000 +0100
+@@ -411,6 +411,9 @@
+ @table @option
+ ETEXI
+ 
++DEF("id", HAS_ARG, QEMU_OPTION_id,
++    "-id n	     set the VMID\n", QEMU_ARCH_ALL)
++
+ DEF("fda", HAS_ARG, QEMU_OPTION_fda,
+     "-fda/-fdb file  use 'file' as floppy disk 0/1 image\n", QEMU_ARCH_ALL)
+ DEF("fdb", HAS_ARG, QEMU_OPTION_fdb, "", QEMU_ARCH_ALL)
+Index: new/vl.c
+===================================================================
+--- new.orig/vl.c	2014-11-20 06:45:06.000000000 +0100
++++ new/vl.c	2014-11-20 06:50:44.000000000 +0100
+@@ -2730,6 +2730,7 @@
+ int main(int argc, char **argv, char **envp)
+ {
+     int i;
++    long int vm_id_long = 0;
+     int snapshot, linux_boot;
+     const char *initrd_filename;
+     const char *kernel_filename, *kernel_cmdline;
+@@ -3477,6 +3478,14 @@
+                     exit(1);
+                 }
+                 break;
++            case QEMU_OPTION_id:
++                vm_id_long = strtol(optarg, (char **) &optarg, 10);
++                if (*optarg != 0 || vm_id_long < 100 || vm_id_long > INT_MAX) {
++                    fprintf(stderr, "Invalid ID\n");
++                    exit(1);
++                }
++                pve_auth_setup(vm_id_long);
++                break;
+             case QEMU_OPTION_vnc:
+ #ifdef CONFIG_VNC
+                 if (vnc_parse_func(optarg) == NULL) {
+Index: new/include/ui/console.h
+===================================================================
+--- new.orig/include/ui/console.h	2014-11-20 06:45:06.000000000 +0100
++++ new/include/ui/console.h	2014-11-20 06:50:55.000000000 +0100
+@@ -328,6 +328,7 @@
+ void cocoa_display_init(DisplayState *ds, int full_screen);
+ 
+ /* vnc.c */
++void pve_auth_setup(int vmid);
+ void vnc_display_init(const char *id);
+ void vnc_display_open(const char *id, Error **errp);
+ void vnc_display_add_client(const char *id, int csock, bool skipauth);
 Index: new/ui/vnc.c
 ===================================================================
 --- new.orig/ui/vnc.c	2014-11-20 06:50:51.000000000 +0100
 +++ new/ui/vnc.c	2014-11-20 06:50:55.000000000 +0100
-@@ -46,6 +46,125 @@
+@@ -48,6 +48,125 @@
  #include "vnc_keysym.h"
  #include "d3des.h"
  
@@ -125,32 +178,11 @@ Index: new/ui/vnc.c
 +	return -1;
 +}
 +
- static VncDisplay *vnc_display; /* needed for info vnc */
+ static QTAILQ_HEAD(, VncDisplay) vnc_displays =
+     QTAILQ_HEAD_INITIALIZER(vnc_displays);
  
- static int vnc_cursor_define(VncState *vs);
-@@ -3156,6 +3275,7 @@
-             tls = 1; /* Require TLS */
-         } else if (strncmp(options, "x509", 4) == 0) {
-             char *start, *end;
-+            tls = 1; /* Require TLS */
-             x509 = 1; /* Require x509 certificates */
-             if (strncmp(options, "x509verify", 10) == 0)
-                 vs->tls.x509verify = 1; /* ...and verify client certs */
-@@ -3176,8 +3296,10 @@
-                 }
-                 g_free(path);
-             } else {
--                error_setg(errp, "No certificate path provided");
--                goto fail;
-+		if (pve_tls_set_x509_creds_dir(vs) < 0) {
-+                    error_setg(errp, "No certificate path provided");
-+                    goto fail;
-+		} 
+@@ -3393,10 +3512,10 @@
              }
- #endif
- #if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL)
-@@ -3250,10 +3372,10 @@
-             vs->auth = VNC_AUTH_VENCRYPT;
              if (x509) {
                  VNC_DEBUG("Initializing VNC server with x509 password auth\n");
 -                vs->subauth = VNC_AUTH_VENCRYPT_X509VNC;
@@ -161,7 +193,23 @@ Index: new/ui/vnc.c
 +                vs->subauth = VNC_AUTH_VENCRYPT_TLSPLAIN;
              }
          } else {
- #endif /* CONFIG_VNC_TLS */
+             VNC_DEBUG("Initializing VNC server with password auth\n");
+@@ -3557,7 +3676,14 @@
+             vs->tls.x509verify = true;
+         }
+     }
+-    if (path) {
++    if (path && strcmp(path, "on") == 0) {
++        x509 = true;
++        tls = true;
++        if (pve_tls_set_x509_creds_dir(vs) < 0) {
++            error_setg(errp, "No certificate path provided");
++            goto fail;
++        }
++    } else if (path) {
+         x509 = true;
+         if (vnc_tls_set_x509_creds_dir(vs, path) < 0) {
+             error_setg(errp, "Failed to find x509 certificates/keys in %s",
 Index: new/ui/vnc-auth-vencrypt.c
 ===================================================================
 --- new.orig/ui/vnc-auth-vencrypt.c	2014-11-20 06:45:06.000000000 +0100
@@ -291,16 +339,16 @@ Index: new/ui/vnc.h
 ===================================================================
 --- new.orig/ui/vnc.h	2014-11-20 06:45:06.000000000 +0100
 +++ new/ui/vnc.h	2014-11-20 06:50:55.000000000 +0100
-@@ -282,6 +282,8 @@
-     char challenge[VNC_AUTH_CHALLENGE_SIZE];
- #ifdef CONFIG_VNC_TLS
+@@ -288,6 +288,8 @@
+     int auth;
      int subauth; /* Used by VeNCrypt */
+     char challenge[VNC_AUTH_CHALLENGE_SIZE];
 +    int username_len;
 +    int password_len;
+ #ifdef CONFIG_VNC_TLS
      VncStateTLS tls;
  #endif
- #ifdef CONFIG_VNC_SASL
-@@ -597,4 +599,6 @@
+@@ -603,4 +605,6 @@
  int vnc_zywrle_send_framebuffer_update(VncState *vs, int x, int y, int w, int h);
  void vnc_zrle_clear(VncState *vs);
  
@@ -338,7 +386,7 @@ Index: new/ui/vnc-tls.c
      rc = gnutls_kx_set_priority(s, x509 ? kx_x509 : kx_anon);
      if (rc != GNUTLS_E_SUCCESS) {
          return -1;
-@@ -462,6 +475,24 @@
+@@ -448,6 +460,24 @@
      return 0;
  }
  
@@ -367,7 +415,7 @@ Index: new/ui/vnc-tls.h
 ===================================================================
 --- new.orig/ui/vnc-tls.h	2014-11-20 06:45:06.000000000 +0100
 +++ new/ui/vnc-tls.h	2014-11-20 06:50:55.000000000 +0100
-@@ -68,6 +68,8 @@
+@@ -61,6 +61,8 @@
  
  int vnc_tls_validate_certificate(VncState *vs);
  
@@ -376,27 +424,3 @@ Index: new/ui/vnc-tls.h
  int vnc_tls_set_x509_creds_dir(VncDisplay *vd,
  			       const char *path);
  
-Index: new/vl.c
-===================================================================
---- new.orig/vl.c	2014-11-20 06:50:44.000000000 +0100
-+++ new/vl.c	2014-11-20 06:50:55.000000000 +0100
-@@ -3573,6 +3573,7 @@
- 		    fprintf(stderr, "Invalid ID\n");
- 		    exit(1);
- 		}
-+		pve_auth_setup(fairsched_id);
-                 break;
-             case QEMU_OPTION_cpuunits:
-                 cpuunits = atoi(optarg);
-Index: new/include/ui/console.h
-===================================================================
---- new.orig/include/ui/console.h	2014-11-20 06:45:06.000000000 +0100
-+++ new/include/ui/console.h	2014-11-20 06:50:55.000000000 +0100
-@@ -327,6 +327,7 @@
- void cocoa_display_init(DisplayState *ds, int full_screen);
- 
- /* vnc.c */
-+void pve_auth_setup(int vmid);
- void vnc_display_init(DisplayState *ds);
- void vnc_display_open(DisplayState *ds, const char *display, Error **errp);
- void vnc_display_add_client(DisplayState *ds, int csock, bool skipauth);
diff --git a/debian/patches/series b/debian/patches/series
index 5041ded..d2e0ecf 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,6 +1,5 @@
 fr-ca-keymap-corrections.diff
 adjust-path.diff
-fairsched.diff
 keymap.diff
 pve-auth.patch
 vencrypt-auth-plain.patch
@@ -29,9 +28,5 @@ disable-efi-enable-pxe-roms.patch
 backup-vma-allow-empty-backups.patch
 glusterfs-daemonize.patch
 gluster-backupserver.patch
-virtio-balloon-dimmfix1.patch
-virtio-balloon-dimmfix2.patch
-virtio-balloon-dimmfix3.patch
 add-qmp-get-link-status.patch
-virtio-scsi_fix_assert.patch
 0001-friendlier-ai_flag-hints-for-ipv6-hosts.patch
diff --git a/debian/patches/virtio-balloon-dimmfix1.patch b/debian/patches/virtio-balloon-dimmfix1.patch
deleted file mode 100644
index 3f1e1ad..0000000
--- a/debian/patches/virtio-balloon-dimmfix1.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From patchwork Wed Mar  4 19:13:32 2015
-Content-Type: text/plain; charset="utf-8"
-MIME-Version: 1.0
-Content-Transfer-Encoding: 7bit
-Subject: [PULL,
- 2/5] virtio-balloon: Fix balloon not working correctly when hotplug
- memory
-From: Luiz Capitulino <lcapitulino at redhat.com>
-X-Patchwork-Id: 446384
-Message-Id: <1425496415-6161-3-git-send-email-lcapitulino at redhat.com>
-To: peter.maydell at linaro.org
-Cc: qemu-devel at nongnu.org
-Date: Wed,  4 Mar 2015 14:13:32 -0500
-
-From: zhanghailiang <zhang.zhanghailiang at huawei.com>
-
-When do memory balloon, it takes the 'ram_size' as the VM's current ram size,
-But 'ram_size' is the startup configured ram size, it does not take into
-account the hotplugged memory.
-
-As a result, the balloon result will be confused.
-Steps to reproduce:
-(1)Start VM: qemu -m size=1024,slots=4,maxmem=8G
-(2)In VM: #free -m : 1024M
-(3)qmp balloon 512M
-(4)In VM: #free -m : 512M
-(5)hotplug pc-dimm 1G
-(6)In VM: #free -m : 1512M
-(7)qmp balloon 256M
-(8)In VM: #free -m :1256M
-We expect the VM's available ram size to be 256M after 'qmp balloon 256M'
-command, but VM's real available ram size is 1256M.
-
-For "qmp balloon" is not performance critical code, we use function
-'get_current_ram_size' to get VM's current ram size.
-
-Signed-off-by: zhanghailiang <zhang.zhanghailiang at huawei.com>
-Signed-off-by: Luiz Capitulino <lcapitulino at redhat.com>
-Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
----
- hw/virtio/virtio-balloon.c |   16 +++++++++-------
- 1 file changed, 9 insertions(+), 7 deletions(-)
-
-diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
-index 14390e1..df3333c 100644
---- a/hw/virtio/virtio-balloon.c
-+++ b/hw/virtio/virtio-balloon.c
-@@ -294,10 +294,12 @@ static void virtio_balloon_set_config(VirtIODevice *vdev,
-     VirtIOBalloon *dev = VIRTIO_BALLOON(vdev);
-     struct virtio_balloon_config config;
-     uint32_t oldactual = dev->actual;
-+    ram_addr_t vm_ram_size = get_current_ram_size();
-+
-     memcpy(&config, config_data, sizeof(struct virtio_balloon_config));
-     dev->actual = le32_to_cpu(config.actual);
-     if (dev->actual != oldactual) {
--        qapi_event_send_balloon_change(ram_size -
-+        qapi_event_send_balloon_change(vm_ram_size -
-                         ((ram_addr_t) dev->actual << VIRTIO_BALLOON_PFN_SHIFT),
-                         &error_abort);
-     }
-@@ -312,9 +314,8 @@ static uint32_t virtio_balloon_get_features(VirtIODevice *vdev, uint32_t f)
- static void virtio_balloon_stat(void *opaque, BalloonInfo *info)
- {
-     VirtIOBalloon *dev = opaque;
--    info->actual = ram_size - ((uint64_t) dev->actual <<
--                               VIRTIO_BALLOON_PFN_SHIFT);
--
-+    info->actual = get_current_ram_size() - ((uint64_t) dev->actual <<
-+                                             VIRTIO_BALLOON_PFN_SHIFT);
-     info->max_mem = ram_size;
- 
-     if (!(balloon_stats_enabled(dev) && balloon_stats_supported(dev) &&
-@@ -349,12 +350,13 @@ static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
- {
-     VirtIOBalloon *dev = VIRTIO_BALLOON(opaque);
-     VirtIODevice *vdev = VIRTIO_DEVICE(dev);
-+    ram_addr_t vm_ram_size = get_current_ram_size();
- 
--    if (target > ram_size) {
--        target = ram_size;
-+    if (target > vm_ram_size) {
-+        target = vm_ram_size;
-     }
-     if (target) {
--        dev->num_pages = (ram_size - target) >> VIRTIO_BALLOON_PFN_SHIFT;
-+        dev->num_pages = (vm_ram_size - target) >> VIRTIO_BALLOON_PFN_SHIFT;
-         virtio_notify_config(vdev);
-     }
- }
--- 
-1.7.10.4
-
diff --git a/debian/patches/virtio-balloon-dimmfix2.patch b/debian/patches/virtio-balloon-dimmfix2.patch
deleted file mode 100644
index 782d5a4..0000000
--- a/debian/patches/virtio-balloon-dimmfix2.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From patchwork Wed Mar  4 19:13:31 2015
-Content-Type: text/plain; charset="utf-8"
-MIME-Version: 1.0
-Content-Transfer-Encoding: 7bit
-Subject: [PULL, 1/5] pc-dimm: add a function to calculate VM's current RAM size
-From: Luiz Capitulino <lcapitulino at redhat.com>
-X-Patchwork-Id: 446386
-Message-Id: <1425496415-6161-2-git-send-email-lcapitulino at redhat.com>
-To: peter.maydell at linaro.org
-Cc: qemu-devel at nongnu.org
-Date: Wed,  4 Mar 2015 14:13:31 -0500
-
-From: zhanghailiang <zhang.zhanghailiang at huawei.com>
-
-The global parameter 'ram_size' does not take into account
-the hotplugged memory.
-
-In some codes, we use 'ram_size' as current VM's real RAM size,
-which is not correct.
-
-Add function 'get_current_ram_size' to calculate VM's current RAM size,
-it will enumerate present memory devices and also plus ram_size.
-
-Signed-off-by: zhanghailiang <zhang.zhanghailiang at huawei.com>
-Signed-off-by: Luiz Capitulino <lcapitulino at redhat.com>
----
- hw/mem/pc-dimm.c                | 26 ++++++++++++++++++++++++++
- include/exec/cpu-common.h       |  1 +
- stubs/qmp_pc_dimm_device_list.c |  5 +++++
- 3 files changed, 32 insertions(+)
-
-diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
-index f27a087..de81b9c 100644
---- a/hw/mem/pc-dimm.c
-+++ b/hw/mem/pc-dimm.c
-@@ -100,6 +100,32 @@ int qmp_pc_dimm_device_list(Object *obj, void *opaque)
-     return 0;
- }
- 
-+ram_addr_t get_current_ram_size(void)
-+{
-+    MemoryDeviceInfoList *info_list = NULL;
-+    MemoryDeviceInfoList **prev = &info_list;
-+    MemoryDeviceInfoList *info;
-+    ram_addr_t size = ram_size;
-+
-+    qmp_pc_dimm_device_list(qdev_get_machine(), &prev);
-+    for (info = info_list; info; info = info->next) {
-+        MemoryDeviceInfo *value = info->value;
-+
-+        if (value) {
-+            switch (value->kind) {
-+            case MEMORY_DEVICE_INFO_KIND_DIMM:
-+                size += value->dimm->size;
-+                break;
-+            default:
-+                break;
-+            }
-+        }
-+    }
-+    qapi_free_MemoryDeviceInfoList(info_list);
-+
-+    return size;
-+}
-+
- static int pc_dimm_slot2bitmap(Object *obj, void *opaque)
- {
-     unsigned long *bitmap = opaque;
-diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
-index 427b851..fcc3162 100644
---- a/include/exec/cpu-common.h
-+++ b/include/exec/cpu-common.h
-@@ -52,6 +52,7 @@ typedef uintptr_t ram_addr_t;
- #endif
- 
- extern ram_addr_t ram_size;
-+ram_addr_t get_current_ram_size(void);
- 
- /* memory API */
- 
-diff --git a/stubs/qmp_pc_dimm_device_list.c b/stubs/qmp_pc_dimm_device_list.c
-index 5cb220c..b584bd8 100644
---- a/stubs/qmp_pc_dimm_device_list.c
-+++ b/stubs/qmp_pc_dimm_device_list.c
-@@ -5,3 +5,8 @@ int qmp_pc_dimm_device_list(Object *obj, void *opaque)
- {
-    return 0;
- }
-+
-+ram_addr_t get_current_ram_size(void)
-+{
-+    return ram_size;
-+}
diff --git a/debian/patches/virtio-balloon-dimmfix3.patch b/debian/patches/virtio-balloon-dimmfix3.patch
deleted file mode 100644
index a8de329..0000000
--- a/debian/patches/virtio-balloon-dimmfix3.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From f818a6aa247b71e8185a3277910ac1cd935432d1 Mon Sep 17 00:00:00 2001
-From: Alexandre Derumier <aderumier at odiso.com>
-Date: Mon, 9 Mar 2015 10:18:01 +0100
-Subject: [PATCH] info max_mem : get_current_ram_size
-
-
-Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
----
- hw/virtio/virtio-balloon.c |    2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
-index df3333c..7f6da3f 100644
---- a/hw/virtio/virtio-balloon.c
-+++ b/hw/virtio/virtio-balloon.c
-@@ -316,7 +316,7 @@ static void virtio_balloon_stat(void *opaque, BalloonInfo *info)
-     VirtIOBalloon *dev = opaque;
-     info->actual = get_current_ram_size() - ((uint64_t) dev->actual <<
-                                              VIRTIO_BALLOON_PFN_SHIFT);
--    info->max_mem = ram_size;
-+    info->max_mem = get_current_ram_size();
- 
-     if (!(balloon_stats_enabled(dev) && balloon_stats_supported(dev) &&
- 	    dev->stats_last_update)) {
--- 
-1.7.10.4
-
diff --git a/debian/patches/virtio-balloon-fix-query.patch b/debian/patches/virtio-balloon-fix-query.patch
index 2220073..236a624 100644
--- a/debian/patches/virtio-balloon-fix-query.patch
+++ b/debian/patches/virtio-balloon-fix-query.patch
@@ -2,7 +2,7 @@ Index: new/hmp.c
 ===================================================================
 --- new.orig/hmp.c	2014-11-20 06:45:05.000000000 +0100
 +++ new/hmp.c	2014-11-20 07:26:23.000000000 +0100
-@@ -539,7 +539,35 @@
+@@ -635,7 +635,35 @@
          return;
      }
  
@@ -43,16 +43,21 @@ Index: new/hw/virtio/virtio-balloon.c
 ===================================================================
 --- new.orig/hw/virtio/virtio-balloon.c	2014-11-20 06:45:06.000000000 +0100
 +++ new/hw/virtio/virtio-balloon.c	2014-11-20 07:26:23.000000000 +0100
-@@ -314,6 +314,35 @@
+@@ -319,8 +319,37 @@
+ static void virtio_balloon_stat(void *opaque, BalloonInfo *info)
+ {
      VirtIOBalloon *dev = opaque;
-     info->actual = ram_size - ((uint64_t) dev->actual <<
-                                VIRTIO_BALLOON_PFN_SHIFT);
+-    info->actual = get_current_ram_size() - ((uint64_t) dev->actual <<
+-                                             VIRTIO_BALLOON_PFN_SHIFT);
++    ram_addr_t ram_size = get_current_ram_size();
++    info->actual = ram_size - ((uint64_t) dev->actual <<
++                               VIRTIO_BALLOON_PFN_SHIFT);
 +
 +    info->max_mem = ram_size;
 +
 +    if (!(balloon_stats_enabled(dev) && balloon_stats_supported(dev) &&
-+	    dev->stats_last_update)) {
-+	return;
++           dev->stats_last_update)) {
++       return;
 +    }
 +
 +    info->last_update = dev->stats_last_update;
@@ -75,7 +80,6 @@ Index: new/hw/virtio/virtio-balloon.c
 +
 +    info->total_mem = dev->stats[VIRTIO_BALLOON_S_MEMTOT];
 +    info->has_total_mem = info->total_mem >= 0 ? true : false;
-+
  }
  
  static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
@@ -83,7 +87,7 @@ Index: new/qapi-schema.json
 ===================================================================
 --- new.orig/qapi-schema.json	2014-11-20 06:45:06.000000000 +0100
 +++ new/qapi-schema.json	2014-11-20 07:26:23.000000000 +0100
-@@ -888,15 +888,34 @@
+@@ -983,15 +983,34 @@
  
  ##
  # @BalloonInfo:
@@ -125,7 +129,7 @@ Index: new/qmp-commands.hx
 ===================================================================
 --- new.orig/qmp-commands.hx	2014-11-20 06:45:06.000000000 +0100
 +++ new/qmp-commands.hx	2014-11-20 07:26:23.000000000 +0100
-@@ -3234,6 +3234,13 @@
+@@ -3329,6 +3329,13 @@
  json-object will be returned containing the following data:
  
  - "actual": current balloon value in bytes (json-int)
@@ -139,7 +143,7 @@ Index: new/qmp-commands.hx
  
  Example:
  
-@@ -3241,6 +3248,12 @@
+@@ -3336,6 +3344,12 @@
  <- {
        "return":{
           "actual":1073741824,
diff --git a/debian/patches/virtio-scsi_fix_assert.patch b/debian/patches/virtio-scsi_fix_assert.patch
deleted file mode 100644
index 4e4ccce..0000000
--- a/debian/patches/virtio-scsi_fix_assert.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 3ad2a905f10a4a9e7c7a385d64032a291eb6892b Mon Sep 17 00:00:00 2001
-From: Fam Zheng <famz at redhat.com>
-Date: Fri, 13 Mar 2015 15:55:54 +0800
-Subject: [PATCH] virtio-scsi: Fix assert in virtio_scsi_push_event
-
-Hotplugging a scsi-disk may trigger the assertion in qemu_sgl_concat.
-
-    qemu-system-x86_64: qemu/hw/scsi/virtio-scsi.c:115: qemu_sgl_concat:
-    Assertion `skip == 0' failed.
-
-This is introduced by commit 55783a55 (virtio-scsi: work around bug in
-old BIOSes) which didn't check out_num when accessing out_sg[0].iov_len
-(the same to in sg). For virtio_scsi_push_event, looking into out_sg
-doesn't make sense because 0 req_size is intended.
-
-Cc: qemu-stable at nongnu.org
-[Cc'ing qemu-stable because 55783a55 did it too]
-Signed-off-by: Fam Zheng <famz at redhat.com>
-Signed-off-by: Stefan Priebe <s.priebe at profihost.ag>
----
- hw/scsi/virtio-scsi.c |    8 ++++++--
- 1 file changed, 6 insertions(+), 2 deletions(-)
-
-diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
-index a44c410..810c377 100644
---- a/hw/scsi/virtio-scsi.c
-+++ b/hw/scsi/virtio-scsi.c
-@@ -145,8 +145,12 @@ static int virtio_scsi_parse_req(VirtIOSCSIReq *req,
-      * TODO: always disable this workaround for virtio 1.0 devices.
-      */
-     if ((vdev->guest_features & (1 << VIRTIO_F_ANY_LAYOUT)) == 0) {
--        req_size = req->elem.out_sg[0].iov_len;
--        resp_size = req->elem.in_sg[0].iov_len;
-+        if (req->elem.out_num) {
-+            req_size = req->elem.out_sg[0].iov_len;
-+        }
-+        if (req->elem.in_num) {
-+            resp_size = req->elem.in_sg[0].iov_len;
-+        }
-     }
- 
-     out_size = qemu_sgl_concat(req, req->elem.out_sg,
--- 
-1.7.10.4
-
-- 
2.1.4





More information about the pve-devel mailing list